8187443: Forest Consolidation: Move files to unified layout

Reviewed-by: darcy, ihse
This commit is contained in:
Erik Joelsson 2017-09-12 19:03:39 +02:00
parent 270fe13182
commit 3789983e89
56923 changed files with 3 additions and 15727 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,157 @@
/*
* Copyright (c) 2005, 2011, 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.io.*;
import java.util.*;
/**
* This class is used to help in localization of resources,
* especially the exception strings.
*
* @author Amit Handa
*/
public class JdbcRowSetResourceBundle implements Serializable {
/**
* This <code>String</code> variable stores the location
* of the resource bundle location.
*/
private static String fileName;
/**
* This variable will hold the <code>PropertyResourceBundle</code>
* of the text to be internationalized.
*/
private transient PropertyResourceBundle propResBundle;
/**
* The constructor initializes to this object
*
*/
private static volatile JdbcRowSetResourceBundle jpResBundle;
/**
* The variable which will represent the properties
* the suffix or extension of the resource bundle.
**/
private static final String PROPERTIES = "properties";
/**
* The variable to represent underscore
**/
private static final String UNDERSCORE = "_";
/**
* The variable which will represent dot
**/
private static final String DOT = ".";
/**
* The variable which will represent the slash.
**/
private static final String SLASH = "/";
/**
* The variable where the default resource bundle will
* be placed.
**/
private static final String PATH = "com/sun/rowset/RowSetResourceBundle";
/**
* The constructor which initializes the resource bundle.
* Note this is a private constructor and follows Singleton
* Design Pattern.
*
* @throws IOException if unable to load the ResourceBundle
* according to locale or the default one.
*/
private JdbcRowSetResourceBundle () throws IOException {
// Try to load the resource bundle according
// to the locale. Else if no bundle found according
// to the locale load the default.
// In default case the default locale resource bundle
// should always be loaded else it
// will be difficult to throw appropriate
// exception string messages.
Locale locale = Locale.getDefault();
// Load appropriate bundle according to locale
propResBundle = (PropertyResourceBundle) ResourceBundle.getBundle(PATH,
locale, JdbcRowSetResourceBundle.class.getModule());
}
/**
* This method is used to get a handle to the
* initialized instance of this class. Note that
* at any time there is only one instance of this
* class initialized which will be returned.
*
* @throws IOException if unable to find the RowSetResourceBundle.properties
*/
public static JdbcRowSetResourceBundle getJdbcRowSetResourceBundle()
throws IOException {
if(jpResBundle == null){
synchronized(JdbcRowSetResourceBundle.class) {
if(jpResBundle == null){
jpResBundle = new JdbcRowSetResourceBundle();
} //end if
} //end synchronized block
} //end if
return jpResBundle;
}
/**
* This method returns an enumerated handle of the keys
* which correspond to values translated to various locales.
*
* @return an enumeration of keys which have messages tranlated to
* corresponding locales.
*/
@SuppressWarnings("rawtypes")
public Enumeration getKeys() {
return propResBundle.getKeys();
}
/**
* This method takes the key as an argument and
* returns the corresponding value reading it
* from the Resource Bundle loaded earlier.
*
* @return value in locale specific language
* according to the key passed.
*/
public Object handleGetObject(String key) {
return propResBundle.handleGetObject(key);
}
static final long serialVersionUID = 436199386225359954L;
}

File diff suppressed because it is too large Load diff

View file

@ -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
* <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();
}
}

View file

@ -0,0 +1,170 @@
#
# Copyright (c) 2005, 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.
#
# CacheRowSetImpl exceptions
cachedrowsetimpl.populate = Invalid ResultSet object supplied to populate method
cachedrowsetimpl.invalidp = Invalid persistence provider generated
cachedrowsetimpl.nullhash = Cannot instantiate CachedRowSetImpl instance. Null Hashtable supplied to constructor
cachedrowsetimpl.invalidop = Invalid operation while on insert row
cachedrowsetimpl.accfailed = acceptChanges Failed
cachedrowsetimpl.invalidcp = Invalid cursor position
cachedrowsetimpl.illegalop = Illegal operation on non-inserted row
cachedrowsetimpl.clonefail = Clone failed: {0}
cachedrowsetimpl.invalidcol = Invalid column index
cachedrowsetimpl.invalcolnm = Invalid column name
cachedrowsetimpl.boolfail = getBoolen Failed on value ( {0} ) in column {1}
cachedrowsetimpl.bytefail = getByte Failed on value ( {0} ) in column {1}
cachedrowsetimpl.shortfail = getShort Failed on value ( {0} ) in column {1}
cachedrowsetimpl.intfail = getInt Failed on value ( {0} ) in column {1}
cachedrowsetimpl.longfail = getLong Failed on value ( {0} ) in column {1}
cachedrowsetimpl.floatfail = getFloat failed on value ( {0} ) in column {1}
cachedrowsetimpl.doublefail = getDouble failed on value ( {0} ) in column {1}
cachedrowsetimpl.dtypemismt = Data Type Mismatch
cachedrowsetimpl.datefail = getDate Failed on value ( {0} ) in column {1} no conversion available
cachedrowsetimpl.timefail = getTime failed on value ( {0} ) in column {1} no conversion available
cachedrowsetimpl.posupdate = Positioned updates not supported
cachedrowsetimpl.unableins = Unable to instantiate : {0}
cachedrowsetimpl.beforefirst = beforeFirst : Invalid cursor operation
cachedrowsetimpl.first = First : Invalid cursor operation
cachedrowsetimpl.last = last : TYPE_FORWARD_ONLY
cachedrowsetimpl.absolute = absolute : Invalid cursor position
cachedrowsetimpl.relative = relative : Invalid cursor position
cachedrowsetimpl.asciistream = read failed for ascii stream
cachedrowsetimpl.binstream = read failed on binary stream
cachedrowsetimpl.failedins = Failed on insert row
cachedrowsetimpl.updateins = updateRow called while on insert row
cachedrowsetimpl.movetoins = moveToInsertRow : CONCUR_READ_ONLY
cachedrowsetimpl.movetoins1 = moveToInsertRow : no meta data
cachedrowsetimpl.movetoins2 = moveToInsertRow : invalid number of columns
cachedrowsetimpl.tablename = Table name cannot be null
cachedrowsetimpl.keycols = Invalid key columns
cachedrowsetimpl.invalidcol = Invalid column index
cachedrowsetimpl.opnotsupp = Operation not supported by Database
cachedrowsetimpl.matchcols = Match columns are not the same as those set
cachedrowsetimpl.setmatchcols = Set Match columns before getting them
cachedrowsetimpl.matchcols1 = Match columns should be greater than 0
cachedrowsetimpl.matchcols2 = Match columns should be empty or null string
cachedrowsetimpl.unsetmatch = Columns being unset are not the same as set
cachedrowsetimpl.unsetmatch1 = Use column name as argument to unsetMatchColumn
cachedrowsetimpl.unsetmatch2 = Use column ID as argument to unsetMatchColumn
cachedrowsetimpl.numrows = Number of rows is less than zero or less than fetch size
cachedrowsetimpl.startpos = Start position cannot be negative
cachedrowsetimpl.nextpage = Populate data before calling
cachedrowsetimpl.pagesize = Page size cannot be less than zero
cachedrowsetimpl.pagesize1 = Page size cannot be greater than maxRows
cachedrowsetimpl.fwdonly = ResultSet is forward only
cachedrowsetimpl.type = Type is : {0}
cachedrowsetimpl.opnotysupp = Operation not yet supported
cachedrowsetimpl.featnotsupp = Feature not supported
# WebRowSetImpl exceptions
webrowsetimpl.nullhash = Cannot instantiate WebRowSetImpl instance. Null Hashtable supplied to constructor
webrowsetimpl.invalidwr = Invalid writer
webrowsetimpl.invalidrd = Invalid reader
#FilteredRowSetImpl exceptions
filteredrowsetimpl.relative = relative : Invalid cursor operation
filteredrowsetimpl.absolute = absolute : Invalid cursor operation
filteredrowsetimpl.notallowed = This value is not allowed through the filter
#JoinRowSetImpl exceptions
joinrowsetimpl.notinstance = Not an instance of rowset
joinrowsetimpl.matchnotset = Match Column not set for join
joinrowsetimpl.numnotequal = Number of elements in rowset not equal to match column
joinrowsetimpl.notdefined = This is not a defined type of join
joinrowsetimpl.notsupported = This type of join is not supported
joinrowsetimpl.initerror = JoinRowSet initialization error
joinrowsetimpl.genericerr = Genric joinrowset intial error
joinrowsetimpl.emptyrowset = Empty rowset cannot be added to this JoinRowSet
#JdbcRowSetImpl exceptions
jdbcrowsetimpl.invalstate = Invalid state
jdbcrowsetimpl.connect = JdbcRowSet (connect) JNDI unable to connect
jdbcrowsetimpl.paramtype = Unable to deduce param type
jdbcrowsetimpl.matchcols = Match Columns are not the same as those set
jdbcrowsetimpl.setmatchcols = Set the match columns before getting them
jdbcrowsetimpl.matchcols1 = Match columns should be greater than 0
jdbcrowsetimpl.matchcols2 = Match columns cannot be null or empty string
jdbcrowsetimpl.unsetmatch = Columns being unset are not the same as those set
jdbcrowsetimpl.usecolname = Use column name as argument to unsetMatchColumn
jdbcrowsetimpl.usecolid = Use column ID as argument to unsetMatchColumn
jdbcrowsetimpl.resnotupd = ResultSet is not updatable
jdbcrowsetimpl.opnotysupp = Operation not yet supported
jdbcrowsetimpl.featnotsupp = Feature not supported
#CachedRowSetReader exceptions
crsreader.connect = (JNDI) Unable to connect
crsreader.paramtype = Unable to deduce param type
crsreader.connecterr = Internal Error in RowSetReader: no connection or command
crsreader.datedetected = Detected a Date
crsreader.caldetected = Detected a Calendar
#CachedRowSetWriter exceptions
crswriter.connect = Unable to get connection
crswriter.tname = writeData cannot determine table name
crswriter.params1 = Value of params1 : {0}
crswriter.params2 = Value of params2 : {0}
crswriter.conflictsno = conflicts while synchronizing
#InsertRow exceptions
insertrow.novalue = No value has been inserted
#SyncResolverImpl exceptions
syncrsimpl.indexval = Index value out of range
syncrsimpl.noconflict = This column not in conflict
syncrsimpl.syncnotpos = Synchronization is not possible
syncrsimpl.valtores = Value to be resolved can either be in the database or in cachedrowset
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = End of RowSet reached. Invalid cursor position
wrsxmlreader.readxml = readXML : {0}
wrsxmlreader.parseerr = ** Parsing Error : {0} , line : {1} , uri : {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException : {0}
wrsxmlwriter.sqlex = SQLException : {0}
wrsxmlwriter.failedwrite = Failed to write value
wsrxmlwriter.notproper = Not a proper type
#XmlReaderContentHandler exceptions
xmlrch.errmap = Error setting Map : {0}
xmlrch.errmetadata = Error setting metadata : {0}
xmlrch.errinsertval = Error inserting values : {0}
xmlrch.errconstr = Error constructing row : {0}
xmlrch.errdel = Error deleting row : {0}
xmlrch.errinsert = Error constructing insert row : {0}
xmlrch.errinsdel = Error constructing insdel row : {0}
xmlrch.errupdate = Error constructing update row : {0}
xmlrch.errupdrow = Error updating row : {0}
xmlrch.chars = characters :
xmlrch.badvalue = Bad value ; non-nullable property
xmlrch.badvalue1 = Bad value ; non-nullable metadata
xmlrch.warning = ** Warning : {0} , line : {1} , uri : {2}
#RIOptimisticProvider Exceptions
riop.locking = Locking classification is not supported
#RIXMLProvider exceptions
rixml.unsupp = Unsupported with RIXMLProvider

View file

@ -0,0 +1,170 @@
#
# Copyright (c) 2005, 2016, 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.
#
# CacheRowSetImpl exceptions
cachedrowsetimpl.populate = Ung\u00FCltiges ResultSet-Objekt zum Auff\u00FCllen der Methode angegeben
cachedrowsetimpl.invalidp = Ung\u00FCltiger Persistence-Provider generiert
cachedrowsetimpl.nullhash = CachedRowSetImpl-Instanz kann nicht instanziiert werden. Null-Hash-Tabelle f\u00FCr Constructor angegeben
cachedrowsetimpl.invalidop = Ung\u00FCltiger Vorgang beim Zeileneinf\u00FCgen
cachedrowsetimpl.accfailed = acceptChanges nicht erfolgreich
cachedrowsetimpl.invalidcp = Ung\u00FCltige Cursorposition
cachedrowsetimpl.illegalop = Ung\u00FCltiger Vorgang bei nicht eingef\u00FCgter Zeile
cachedrowsetimpl.clonefail = Klonen nicht erfolgreich: {0}
cachedrowsetimpl.invalidcol = Ung\u00FCltiger Spaltenindex
cachedrowsetimpl.invalcolnm = Ung\u00FCltiger Spaltenname
cachedrowsetimpl.boolfail = getBoolen bei Wert ( {0} ) in Spalte {1} nicht erfolgreich
cachedrowsetimpl.bytefail = getByte bei Wert ( {0} ) in Spalte {1} nicht erfolgreich
cachedrowsetimpl.shortfail = getShort bei Wert ( {0} ) in Spalte {1} nicht erfolgreich
cachedrowsetimpl.intfail = getInt bei Wert ( {0} ) in Spalte {1} nicht erfolgreich
cachedrowsetimpl.longfail = getLong bei Wert ( {0} ) in Spalte {1} nicht erfolgreich
cachedrowsetimpl.floatfail = getFloat bei Wert ( {0} ) in Spalte {1} nicht erfolgreich
cachedrowsetimpl.doublefail = getDouble bei Wert ( {0} ) in Spalte {1} nicht erfolgreich
cachedrowsetimpl.dtypemismt = Keine Datentyp\u00FCbereinstimmung
cachedrowsetimpl.datefail = getDate bei Wert ( {0} ) in Spalte {1} nicht erfolgreich. Keine Konvertierung m\u00F6glich
cachedrowsetimpl.timefail = getTime bei Wert ( {0} ) in Spalte {1} nicht erfolgreich. Keine Konvertierung m\u00F6glich
cachedrowsetimpl.posupdate = Positionierte Updates werden nicht unterst\u00FCtzt
cachedrowsetimpl.unableins = Keine Instanziierung m\u00F6glich: {0}
cachedrowsetimpl.beforefirst = beforeFirst: Ung\u00FCltiger Cursorvorgang
cachedrowsetimpl.first = First: Ung\u00FCltiger Cursorvorgang
cachedrowsetimpl.last = last: TYPE_FORWARD_ONLY
cachedrowsetimpl.absolute = absolute: Ung\u00FCltige Cursorposition
cachedrowsetimpl.relative = relative: Ung\u00FCltige Cursorposition
cachedrowsetimpl.asciistream = Lesen von ASCII-Stream nicht erfolgreich
cachedrowsetimpl.binstream = Lesen von Bin\u00E4r-Stream nicht erfolgreich
cachedrowsetimpl.failedins = Fehler beim Zeileneinf\u00FCgen
cachedrowsetimpl.updateins = updateRow beim Zeileneinf\u00FCgen aufgerufen
cachedrowsetimpl.movetoins = moveToInsertRow: CONCUR_READ_ONLY
cachedrowsetimpl.movetoins1 = moveToInsertRow: keine Metadaten
cachedrowsetimpl.movetoins2 = moveToInsertRow: ung\u00FCltige Spaltenanzahl
cachedrowsetimpl.tablename = Tabellenname darf nicht null sein
cachedrowsetimpl.keycols = Ung\u00FCltige Schl\u00FCsselspalten
cachedrowsetimpl.invalidcol = Ung\u00FCltiger Spaltenindex
cachedrowsetimpl.opnotsupp = Vorgang nicht von Datenbank unterst\u00FCtzt
cachedrowsetimpl.matchcols = \u00DCbereinstimmungsspalten entsprechen nicht den festgelegten Spalten
cachedrowsetimpl.setmatchcols = \u00DCbereinstimmungsspalten m\u00FCssen vor dem Abrufen festgelegt werden
cachedrowsetimpl.matchcols1 = Wert f\u00FCr \u00DCbereinstimmungsspalten muss gr\u00F6\u00DFer als 0 sein
cachedrowsetimpl.matchcols2 = \u00DCbereinstimmungsspalten m\u00FCssen leer sein oder eine Nullzeichenfolge aufweisen
cachedrowsetimpl.unsetmatch = Spalten, deren Wert aufgehoben wird, entsprechen nicht den festgelegten Spalten
cachedrowsetimpl.unsetmatch1 = Spaltenname als Argument f\u00FCr unsetMatchColumn verwenden
cachedrowsetimpl.unsetmatch2 = Spalten-ID als Argument f\u00FCr unsetMatchColumn verwenden
cachedrowsetimpl.numrows = Zeilenanzahl ist kleiner als null oder kleiner als Abrufgr\u00F6\u00DFe
cachedrowsetimpl.startpos = Startposition darf keinen Negativwert aufweisen
cachedrowsetimpl.nextpage = Daten m\u00FCssen vor dem Aufruf ausgef\u00FCllt werden
cachedrowsetimpl.pagesize = Seitengr\u00F6\u00DFe darf nicht kleiner als null sein
cachedrowsetimpl.pagesize1 = Seitengr\u00F6\u00DFe darf nicht gr\u00F6\u00DFer als maxRows sein
cachedrowsetimpl.fwdonly = ResultSet kann nur vorw\u00E4rts gerichtet sein
cachedrowsetimpl.type = Typ ist: {0}
cachedrowsetimpl.opnotysupp = Vorgang noch nicht unterst\u00FCtzt
cachedrowsetimpl.featnotsupp = Feature nicht unterst\u00FCtzt
# WebRowSetImpl exceptions
webrowsetimpl.nullhash = WebRowSetImpl-Instanz kann nicht instanziiert werden. Null-Hash-Tabelle f\u00FCr Constructor angegeben
webrowsetimpl.invalidwr = Ung\u00FCltiger Writer
webrowsetimpl.invalidrd = Ung\u00FCltiger Reader
#FilteredRowSetImpl exceptions
filteredrowsetimpl.relative = relative: Ung\u00FCltiger Cursorvorgang
filteredrowsetimpl.absolute = absolute: Ung\u00FCltiger Cursorvorgang
filteredrowsetimpl.notallowed = Kein zul\u00E4ssiger Wert im Filter
#JoinRowSetImpl exceptions
joinrowsetimpl.notinstance = Keine Instanz von rowset
joinrowsetimpl.matchnotset = \u00DCbereinstimmungsspalte wurde nicht f\u00FCr Join festgelegt
joinrowsetimpl.numnotequal = Elementanzahl in rowset nicht gleich \u00DCbereinstimmungsspalte
joinrowsetimpl.notdefined = Kein definierter Join-Typ
joinrowsetimpl.notsupported = Join-Typ wird nicht unterst\u00FCtzt
joinrowsetimpl.initerror = JoinRowSet-Initialisierungsfehler
joinrowsetimpl.genericerr = Generischer Anfangsfehler bei joinrowset
joinrowsetimpl.emptyrowset = Leeres rowset kann nicht zu diesem JoinRowSet hinzugef\u00FCgt werden
#JdbcRowSetImpl exceptions
jdbcrowsetimpl.invalstate = Ung\u00FCltiger Status
jdbcrowsetimpl.connect = JdbcRowSet (verbinden), keine JNDI-Verbindung m\u00F6glich
jdbcrowsetimpl.paramtype = Parametertyp kann nicht abgeleitet werden
jdbcrowsetimpl.matchcols = \u00DCbereinstimmungsspalten entsprechen nicht den festgelegten Spalten
jdbcrowsetimpl.setmatchcols = \u00DCbereinstimmungsspalten m\u00FCssen vor dem Abrufen festgelegt werden
jdbcrowsetimpl.matchcols1 = Wert f\u00FCr \u00DCbereinstimmungsspalten muss gr\u00F6\u00DFer als 0 sein
jdbcrowsetimpl.matchcols2 = \u00DCbereinstimmungsspalten k\u00F6nnen keine Null- oder leere Zeichenfolge aufweisen
jdbcrowsetimpl.unsetmatch = Spalten, deren Wert aufgehoben wird, entsprechen nicht den festgelegten Spalten
jdbcrowsetimpl.usecolname = Spaltenname als Argument f\u00FCr unsetMatchColumn verwenden
jdbcrowsetimpl.usecolid = Spalten-ID als Argument f\u00FCr unsetMatchColumn verwenden
jdbcrowsetimpl.resnotupd = ResultSet kann nicht aktualisiert werden
jdbcrowsetimpl.opnotysupp = Vorgang noch nicht unterst\u00FCtzt
jdbcrowsetimpl.featnotsupp = Feature nicht unterst\u00FCtzt
#CachedRowSetReader exceptions
crsreader.connect = (JNDI) Verbindung nicht m\u00F6glich
crsreader.paramtype = Parametertyp kann nicht abgeleitet werden
crsreader.connecterr = Interner Fehler in RowSetReader: Keine Verbindung oder kein Befehl
crsreader.datedetected = Datum festgestellt
crsreader.caldetected = Kalender festgestellt
#CachedRowSetWriter exceptions
crswriter.connect = Verbindung kann nicht hergestellt werden
crswriter.tname = writeData kann Tabellennamen nicht bestimmen
crswriter.params1 = Wert f\u00FCr params1: {0}
crswriter.params2 = Wert f\u00FCr params2: {0}
crswriter.conflictsno = Konflikte beim Synchronisieren
#InsertRow exceptions
insertrow.novalue = Es wurde kein Wert eingef\u00FCgt
#SyncResolverImpl exceptions
syncrsimpl.indexval = Indexwert liegt au\u00DFerhalb des Bereichs
syncrsimpl.noconflict = Kein Konflikt bei dieser Spalte
syncrsimpl.syncnotpos = Keine Synchronisierung m\u00F6glich
syncrsimpl.valtores = Aufzul\u00F6sender Wert kann sich entweder in der Datenbank oder in cachedrowset befinden
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = Ende von RowSet wurde erreicht. Ung\u00FCltige Cursorposition
wrsxmlreader.readxml = readXML: {0}
wrsxmlreader.parseerr = ** Parsingfehler: {0}, Zeile: {1} , URI: {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException: {0}
wrsxmlwriter.sqlex = SQLException: {0}
wrsxmlwriter.failedwrite = Schreiben des Wertes nicht erfolgreich
wsrxmlwriter.notproper = Kein zul\u00E4ssiger Typ
#XmlReaderContentHandler exceptions
xmlrch.errmap = Fehler beim Festlegen der Zuordnung: {0}
xmlrch.errmetadata = Fehler beim Festlegen der Metadaten: {0}
xmlrch.errinsertval = Fehler beim Einf\u00FCgen der Werte: {0}
xmlrch.errconstr = Fehler beim Erstellen der Zeile: {0}
xmlrch.errdel = Fehler beim L\u00F6schen der Zeile: {0}
xmlrch.errinsert = Fehler beim Erstellen der Einf\u00FCgezeile: {0}
xmlrch.errinsdel = Fehler beim Erstellen der Einf\u00FCge- oder L\u00F6schzeile: {0}
xmlrch.errupdate = Fehler beim Erstellen der Updatezeile: {0}
xmlrch.errupdrow = Fehler beim Aktualisieren der Zeile: {0}
xmlrch.chars = Zeichen:
xmlrch.badvalue = Ung\u00FCltiger Wert. Eigenschaft kann nicht auf null gesetzt werden
xmlrch.badvalue1 = Ung\u00FCltiger Wert. Metadaten k\u00F6nnen nicht auf null gesetzt werden
xmlrch.warning = ** Warnung: {0}, Zeile: {1} , URI: {2}
#RIOptimisticProvider Exceptions
riop.locking = Sperren der Klassifizierung wird nicht unterst\u00FCtzt
#RIXMLProvider exceptions
rixml.unsupp = Keine Unterst\u00FCtzung bei RIXMLProvider

View file

@ -0,0 +1,170 @@
#
# Copyright (c) 2005, 2013, 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.
#
# CacheRowSetImpl exceptions
cachedrowsetimpl.populate = Se ha proporcionado un objeto ResultSet no v\u00E1lido para el m\u00E9todo de relleno
cachedrowsetimpl.invalidp = El proveedor de persistencia generado no es v\u00E1lido
cachedrowsetimpl.nullhash = La instancia CachedRowSetImpl no se puede crear. Se ha proporcionado una tabla hash nula al constructor
cachedrowsetimpl.invalidop = Operaci\u00F3n no v\u00E1lida al insertar fila
cachedrowsetimpl.accfailed = Fallo de acceptChanges
cachedrowsetimpl.invalidcp = Posici\u00F3n de cursor no v\u00E1lida
cachedrowsetimpl.illegalop = Operaci\u00F3n no permitida en fila no insertada
cachedrowsetimpl.clonefail = Fallo en la clonaci\u00F3n: {0}
cachedrowsetimpl.invalidcol = \u00CDndice de columnas no v\u00E1lido
cachedrowsetimpl.invalcolnm = Nombre de columna no v\u00E1lido
cachedrowsetimpl.boolfail = Fallo de getBoolen en valor ( {0} ) de columna {1}
cachedrowsetimpl.bytefail = Fallo de getByte en valor ( {0} ) de columna {1}
cachedrowsetimpl.shortfail = Fallo de getShort en valor ( {0} ) de columna {1}
cachedrowsetimpl.intfail = Fallo de getInt en valor ( {0} ) de columna {1}
cachedrowsetimpl.longfail = Fallo de getLong en valor ( {0} ) de columna {1}
cachedrowsetimpl.floatfail = Fallo de getFloat en valor ( {0} ) de columna {1}
cachedrowsetimpl.doublefail = Fallo de getDouble en valor ( {0} ) de columna {1}
cachedrowsetimpl.dtypemismt = Discordancia entre Tipos de Datos
cachedrowsetimpl.datefail = Fallo de getDate en valor ( {0} ) de columna {1}. No es posible convertir
cachedrowsetimpl.timefail = Fallo de getTime en valor ( {0} ) de columna {1}. No es posible convertir
cachedrowsetimpl.posupdate = Actualizaciones posicionadas no soportadas
cachedrowsetimpl.unableins = No se ha podido crear la instancia: {0}
cachedrowsetimpl.beforefirst = beforeFirst: Operaci\u00F3n de cursor no v\u00E1lida
cachedrowsetimpl.first = First: Operaci\u00F3n de cursor no v\u00E1lida
cachedrowsetimpl.last = last : TYPE_FORWARD_ONLY
cachedrowsetimpl.absolute = absolute: Posici\u00F3n de cursor no v\u00E1lida
cachedrowsetimpl.relative = relative: Posici\u00F3n de cursor no v\u00E1lida
cachedrowsetimpl.asciistream = fallo en lectura de flujo de caracteres ascii
cachedrowsetimpl.binstream = fallo de lectura de flujo binario
cachedrowsetimpl.failedins = Fallo en inserci\u00F3n de fila
cachedrowsetimpl.updateins = llamada a updateRow mientras se insertaba fila
cachedrowsetimpl.movetoins = moveToInsertRow : CONCUR_READ_ONLY
cachedrowsetimpl.movetoins1 = moveToInsertRow: no hay metadatos
cachedrowsetimpl.movetoins2 = moveToInsertRow: n\u00FAmero de columnas no v\u00E1lido
cachedrowsetimpl.tablename = El nombre de la tabla no puede ser nulo
cachedrowsetimpl.keycols = Columnas clave no v\u00E1lidas
cachedrowsetimpl.invalidcol = \u00CDndice de columnas no v\u00E1lido
cachedrowsetimpl.opnotsupp = La base de datos no admite esta operaci\u00F3n
cachedrowsetimpl.matchcols = Las columnas coincidentes no concuerdan con las definidas
cachedrowsetimpl.setmatchcols = Defina las columnas coincidentes antes de obtenerlas
cachedrowsetimpl.matchcols1 = Las columnas coincidentes deben ser mayores que 0
cachedrowsetimpl.matchcols2 = Las columnas coincidentes deben estar vac\u00EDas o ser una cadena nula
cachedrowsetimpl.unsetmatch = Las columnas cuya definici\u00F3n se est\u00E1 anulando no concuerdan con las definidas
cachedrowsetimpl.unsetmatch1 = Use el nombre de columna como argumento en unsetMatchColumn
cachedrowsetimpl.unsetmatch2 = Use el identificador de columna como argumento en unsetMatchColumn
cachedrowsetimpl.numrows = El n\u00FAmero de filas es menor que cero o menor que el tama\u00F1o recuperado
cachedrowsetimpl.startpos = La posici\u00F3n de inicio no puede ser negativa
cachedrowsetimpl.nextpage = Rellene los datos antes de realizar la llamada
cachedrowsetimpl.pagesize = El tama\u00F1o de p\u00E1gina no puede ser menor que cero
cachedrowsetimpl.pagesize1 = El tama\u00F1o de p\u00E1gina no puede ser mayor que maxRows
cachedrowsetimpl.fwdonly = ResultSet s\u00F3lo se reenv\u00EDa
cachedrowsetimpl.type = El tipo es: {0}
cachedrowsetimpl.opnotysupp = Operaci\u00F3n no soportada todav\u00EDa
cachedrowsetimpl.featnotsupp = Funci\u00F3n no soportada
# WebRowSetImpl exceptions
webrowsetimpl.nullhash = La instancia WebRowSetImpl no se puede crear. Se ha proporcionado una tabla hash nula al constructor
webrowsetimpl.invalidwr = Escritor no v\u00E1lido
webrowsetimpl.invalidrd = Lector no v\u00E1lido
#FilteredRowSetImpl exceptions
filteredrowsetimpl.relative = relative: Operaci\u00F3n de cursor no v\u00E1lida
filteredrowsetimpl.absolute = absolute: Operaci\u00F3n de cursor no v\u00E1lida
filteredrowsetimpl.notallowed = El filtro no admite este valor
#JoinRowSetImpl exceptions
joinrowsetimpl.notinstance = No es una instancia de rowset
joinrowsetimpl.matchnotset = Las columnas coincidentes no est\u00E1n definidas para la uni\u00F3n
joinrowsetimpl.numnotequal = El n\u00FAmero de elementos de rowset y el de columnas coincidentes no es el mismo
joinrowsetimpl.notdefined = No es un tipo de uni\u00F3n definido
joinrowsetimpl.notsupported = Este tipo de uni\u00F3n no est\u00E1 soportado
joinrowsetimpl.initerror = Error de inicializaci\u00F3n de JoinRowSet
joinrowsetimpl.genericerr = Error de inicializaci\u00F3n gen\u00E9rico de joinrowset
joinrowsetimpl.emptyrowset = No se puede agregar un juego de filas vac\u00EDo a este JoinRowSet
#JdbcRowSetImpl exceptions
jdbcrowsetimpl.invalstate = Estado no v\u00E1lido
jdbcrowsetimpl.connect = JdbcRowSet (connect): JNDI no se puede conectar
jdbcrowsetimpl.paramtype = No se puede deducir el tipo de par\u00E1metro
jdbcrowsetimpl.matchcols = Las columnas coincidentes no concuerdan con las definidas
jdbcrowsetimpl.setmatchcols = Defina las columnas coincidentes antes de obtenerlas
jdbcrowsetimpl.matchcols1 = Las columnas coincidentes deben ser mayores que 0
jdbcrowsetimpl.matchcols2 = Las columnas coincidentes no pueden estar vac\u00EDas ni ser una cadena nula
jdbcrowsetimpl.unsetmatch = Las columnas cuya definici\u00F3n se est\u00E1 anulando no concuerdan con las definidas
jdbcrowsetimpl.usecolname = Use el nombre de columna como argumento en unsetMatchColumn
jdbcrowsetimpl.usecolid = Use el identificador de columna como argumento en unsetMatchColumn
jdbcrowsetimpl.resnotupd = ResultSet no se puede actualizar
jdbcrowsetimpl.opnotysupp = Operaci\u00F3n no soportada todav\u00EDa
jdbcrowsetimpl.featnotsupp = Funci\u00F3n no soportada
#CachedRowSetReader exceptions
crsreader.connect = (JNDI) No se ha podido conectar
crsreader.paramtype = No se ha podido deducir el tipo de par\u00E1metro
crsreader.connecterr = Error interno en RowSetReader: no hay conexi\u00F3n o comando
crsreader.datedetected = Fecha Detectada
crsreader.caldetected = Calendario Detectado
#CachedRowSetWriter exceptions
crswriter.connect = No se ha podido obtener una conexi\u00F3n
crswriter.tname = writeData no puede determinar el nombre de tabla
crswriter.params1 = Valor de params1: {0}
crswriter.params2 = Valor de params2: {0}
crswriter.conflictsno = conflictos en la sincronizaci\u00F3n
#InsertRow exceptions
insertrow.novalue = No se ha insertado ning\u00FAn valor
#SyncResolverImpl exceptions
syncrsimpl.indexval = El valor de \u00EDndice est\u00E1 fuera de rango
syncrsimpl.noconflict = Esta columna no est\u00E1 en conflicto
syncrsimpl.syncnotpos = No se puede sincronizar
syncrsimpl.valtores = El valor que se debe resolver puede estar en la base de datos o en cachedrowset
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = Se ha llegado al final de RowSet. Posici\u00F3n de cursor no v\u00E1lida
wrsxmlreader.readxml = readXML : {0}
wrsxmlreader.parseerr = ** Error de an\u00E1lisis: {0} , l\u00EDnea: {1} , uri: {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException : {0}
wrsxmlwriter.sqlex = SQLException : {0}
wrsxmlwriter.failedwrite = Error al escribir el valor
wsrxmlwriter.notproper = Tipo incorrecto
#XmlReaderContentHandler exceptions
xmlrch.errmap = Error al definir la asignaci\u00F3n: {0}
xmlrch.errmetadata = Error al definir metadatos: {0}
xmlrch.errinsertval = Error al insertar los valores: {0}
xmlrch.errconstr = Error al construir la fila: {0}
xmlrch.errdel = Error al suprimir la fila: {0}
xmlrch.errinsert = Error al construir la fila de inserci\u00F3n: {0}
xmlrch.errinsdel = Error al construir la fila de inserci\u00F3n o supresi\u00F3n: {0}
xmlrch.errupdate = Error al construir la fila de actualizaci\u00F3n: {0}
xmlrch.errupdrow = Error al actualizar la fila: {0}
xmlrch.chars = caracteres:
xmlrch.badvalue = Valor incorrecto; la propiedad no puede ser nula
xmlrch.badvalue1 = Valor incorrecto; los metadatos no pueden ser nulos
xmlrch.warning = ** Advertencia: {0} , l\u00EDnea: {1} , uri: {2}
#RIOptimisticProvider Exceptions
riop.locking = No se permite bloquear la clasificaci\u00F3n
#RIXMLProvider exceptions
rixml.unsupp = No soportado con RIXMLProvider

View file

@ -0,0 +1,170 @@
#
# Copyright (c) 2005, 2013, 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.
#
# CacheRowSetImpl exceptions
cachedrowsetimpl.populate = L'objet ResultSet fourni en entr\u00E9e de la m\u00E9thode n'est pas valide
cachedrowsetimpl.invalidp = Le fournisseur de persistance g\u00E9n\u00E9r\u00E9 n'est pas valide
cachedrowsetimpl.nullhash = Impossible de cr\u00E9er une instance de CachedRowSetImpl. Table de hachage NULL fournie au constructeur
cachedrowsetimpl.invalidop = Op\u00E9ration non valide lors de l'insertion de ligne
cachedrowsetimpl.accfailed = Echec de acceptChanges
cachedrowsetimpl.invalidcp = Position du curseur non valide
cachedrowsetimpl.illegalop = Op\u00E9ration non admise sur une ligne non ins\u00E9r\u00E9e
cachedrowsetimpl.clonefail = Echec du clonage : {0}
cachedrowsetimpl.invalidcol = Index de colonne non valide
cachedrowsetimpl.invalcolnm = Nom de colonne non valide
cachedrowsetimpl.boolfail = Echec de getBoolen pour la valeur ({0}) de la colonne {1}
cachedrowsetimpl.bytefail = Echec de getByte pour la valeur ({0}) de la colonne {1}
cachedrowsetimpl.shortfail = Echec de getShort pour la valeur ({0}) de la colonne {1}
cachedrowsetimpl.intfail = Echec de getInt pour la valeur ({0}) de la colonne {1}
cachedrowsetimpl.longfail = Echec de getLong pour la valeur ({0}) de la colonne {1}
cachedrowsetimpl.floatfail = Echec de getFloat pour la valeur ({0}) de la colonne {1}
cachedrowsetimpl.doublefail = Echec de getDouble pour la valeur ({0}) de la colonne {1}
cachedrowsetimpl.dtypemismt = Le type de donn\u00E9es ne correspond pas
cachedrowsetimpl.datefail = Echec de getDate pour la valeur ({0}) de la colonne {1} - Aucune conversion possible
cachedrowsetimpl.timefail = Echec de getTime pour la valeur ({0}) de la colonne {1} - Aucune conversion possible
cachedrowsetimpl.posupdate = Mises \u00E0 jour choisies non prises en charge
cachedrowsetimpl.unableins = Instanciation impossible : {0}
cachedrowsetimpl.beforefirst = beforeFirst : op\u00E9ration de curseur non valide
cachedrowsetimpl.first = First : op\u00E9ration de curseur non valide
cachedrowsetimpl.last = last : TYPE_FORWARD_ONLY
cachedrowsetimpl.absolute = absolute : position de curseur non valide
cachedrowsetimpl.relative = relative : position de curseur non valide
cachedrowsetimpl.asciistream = \u00E9chec de la lecture pour le flux ASCII
cachedrowsetimpl.binstream = \u00E9chec de la lecture pour le flux binaire
cachedrowsetimpl.failedins = Echec de l'insertion de ligne
cachedrowsetimpl.updateins = appel de updateRow lors de l'insertion de ligne
cachedrowsetimpl.movetoins = moveToInsertRow : CONCUR_READ_ONLY
cachedrowsetimpl.movetoins1 = moveToInsertRow : aucune m\u00E9tadonn\u00E9e
cachedrowsetimpl.movetoins2 = moveToInsertRow : nombre de colonnes non valide
cachedrowsetimpl.tablename = Le nom de la table ne peut pas \u00EAtre NULL
cachedrowsetimpl.keycols = Colonnes de cl\u00E9 non valides
cachedrowsetimpl.invalidcol = Index de colonne non valide
cachedrowsetimpl.opnotsupp = Op\u00E9ration non prise en charge par la base de donn\u00E9es
cachedrowsetimpl.matchcols = Les colonnes correspondantes ne sont pas les m\u00EAmes que les colonnes d\u00E9finies
cachedrowsetimpl.setmatchcols = D\u00E9finir les colonnes correspondantes avant de les prendre
cachedrowsetimpl.matchcols1 = Les colonnes correspondantes doivent \u00EAtre sup\u00E9rieures \u00E0 z\u00E9ro
cachedrowsetimpl.matchcols2 = Les colonnes correspondantes doivent \u00EAtres vides ou ne contenir que des cha\u00EEnes NULL
cachedrowsetimpl.unsetmatch = Les colonnes d\u00E9finies et non d\u00E9finies sont diff\u00E9rentes
cachedrowsetimpl.unsetmatch1 = Utiliser le nom de colonne comme argument pour unsetMatchColumn
cachedrowsetimpl.unsetmatch2 = Utiliser l'ID de colonne comme argument pour unsetMatchColumn
cachedrowsetimpl.numrows = Le nombre de lignes est inf\u00E9rieur \u00E0 z\u00E9ro ou \u00E0 la taille d'extraction
cachedrowsetimpl.startpos = La position de d\u00E9part ne peut pas \u00EAtre n\u00E9gative
cachedrowsetimpl.nextpage = Entrer les donn\u00E9es avant l'appel
cachedrowsetimpl.pagesize = La taille de la page ne peut pas \u00EAtre n\u00E9gative
cachedrowsetimpl.pagesize1 = La taille de la page ne peut pas \u00EAtre sup\u00E9rieure \u00E0 maxRows
cachedrowsetimpl.fwdonly = ResultSet va en avant seulement
cachedrowsetimpl.type = Le type est : {0}
cachedrowsetimpl.opnotysupp = Op\u00E9ration non encore prise en charge
cachedrowsetimpl.featnotsupp = Fonctionnalit\u00E9 non prise en charge
# WebRowSetImpl exceptions
webrowsetimpl.nullhash = Impossible de cr\u00E9er une instance de WebRowSetImpl. Table de hachage NULL fournie au constructeur
webrowsetimpl.invalidwr = Processus d'\u00E9criture non valide
webrowsetimpl.invalidrd = Processus de lecture non valide
#FilteredRowSetImpl exceptions
filteredrowsetimpl.relative = relative : op\u00E9ration de curseur non valide
filteredrowsetimpl.absolute = absolute : op\u00E9ration de curseur non valide
filteredrowsetimpl.notallowed = Cette valeur n'est pas autoris\u00E9e via le filtre
#JoinRowSetImpl exceptions
joinrowsetimpl.notinstance = N'est pas une instance de RowSet
joinrowsetimpl.matchnotset = Les colonnes correspondantes ne sont pas d\u00E9finies pour la jointure
joinrowsetimpl.numnotequal = Le nombre d'\u00E9l\u00E9ments dans RowSet est diff\u00E9rent du nombre de colonnes correspondantes
joinrowsetimpl.notdefined = Ce n'est pas un type de jointure d\u00E9fini
joinrowsetimpl.notsupported = Ce type de jointure n'est pas pris en charge
joinrowsetimpl.initerror = Erreur d'initialisation de JoinRowSet
joinrowsetimpl.genericerr = Erreur initiale g\u00E9n\u00E9rique de JoinRowSet
joinrowsetimpl.emptyrowset = Impossible d'ajouter un objet RowSet vide \u00E0 ce JoinRowSet
#JdbcRowSetImpl exceptions
jdbcrowsetimpl.invalstate = Etat non valide
jdbcrowsetimpl.connect = Impossible de connecter JNDI JdbcRowSet (connexion)
jdbcrowsetimpl.paramtype = Impossible de d\u00E9duire le type de param\u00E8tre
jdbcrowsetimpl.matchcols = Les colonnes correspondantes ne sont pas les m\u00EAmes que les colonnes d\u00E9finies
jdbcrowsetimpl.setmatchcols = D\u00E9finir les colonnes correspondantes avant de les prendre
jdbcrowsetimpl.matchcols1 = Les colonnes correspondantes doivent \u00EAtre sup\u00E9rieures \u00E0 z\u00E9ro
jdbcrowsetimpl.matchcols2 = Les colonnes correspondantes ne doivent pas \u00EAtres NULL ni contenir des cha\u00EEnes vides
jdbcrowsetimpl.unsetmatch = Les colonnes non d\u00E9finies ne sont pas les m\u00EAmes que les colonnes d\u00E9finies
jdbcrowsetimpl.usecolname = Utiliser le nom de colonne comme argument pour unsetMatchColumn
jdbcrowsetimpl.usecolid = Utiliser l'ID de colonne comme argument pour unsetMatchColumn
jdbcrowsetimpl.resnotupd = La mise \u00E0 jour de ResultSet est interdite
jdbcrowsetimpl.opnotysupp = Op\u00E9ration non encore prise en charge
jdbcrowsetimpl.featnotsupp = Fonctionnalit\u00E9 non prise en charge
#CachedRowSetReader exceptions
crsreader.connect = Impossible de connecter (JNDI)
crsreader.paramtype = Impossible de d\u00E9duire le type de param\u00E8tre
crsreader.connecterr = Erreur interne dans RowSetReader\u00A0: pas de connexion ni de commande
crsreader.datedetected = Une date a \u00E9t\u00E9 d\u00E9tect\u00E9e
crsreader.caldetected = Un calendrier a \u00E9t\u00E9 d\u00E9tect\u00E9
#CachedRowSetWriter exceptions
crswriter.connect = Impossible d'obtenir la connexion
crswriter.tname = writeData ne peut pas d\u00E9terminer le nom de la table
crswriter.params1 = Valeur de params1 : {0}
crswriter.params2 = Valeur de params2 : {0}
crswriter.conflictsno = conflits lors de la synchronisation
#InsertRow exceptions
insertrow.novalue = Aucune valeur n'a \u00E9t\u00E9 ins\u00E9r\u00E9e
#SyncResolverImpl exceptions
syncrsimpl.indexval = Valeur d'index hors plage
syncrsimpl.noconflict = Cette colonne n'est pas en conflit
syncrsimpl.syncnotpos = La synchronisation est impossible
syncrsimpl.valtores = La valeur \u00E0 r\u00E9soudre peut \u00EAtre soit dans la base de donn\u00E9es, soit dans CachedrowSet
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = Fin de RowSet atteinte. Position de curseur non valide
wrsxmlreader.readxml = readXML : {0}
wrsxmlreader.parseerr = ** Erreur d''analyse : {0} , ligne : {1} , URI : {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = Exception d''E/S : {0}
wrsxmlwriter.sqlex = Exception SQL : {0}
wrsxmlwriter.failedwrite = Echec d'\u00E9criture de la valeur
wsrxmlwriter.notproper = N'est pas un type correct
#XmlReaderContentHandler exceptions
xmlrch.errmap = Erreur lors de la d\u00E9finition du mappage : {0}
xmlrch.errmetadata = Erreur lors de la d\u00E9finition des m\u00E9tadonn\u00E9es : {0}
xmlrch.errinsertval = Erreur lors de l''insertion des valeurs\u00A0: {0}
xmlrch.errconstr = Erreur lors de la construction de la ligne : {0}
xmlrch.errdel = Erreur lors de la suppression de la ligne : {0}
xmlrch.errinsert = Erreur lors de la construction de la ligne \u00E0 ins\u00E9rer : {0}
xmlrch.errinsdel = Erreur lors de la construction de la ligne insdel : {0}
xmlrch.errupdate = Erreur lors de la construction de la ligne \u00E0 mettre \u00E0 jour : {0}
xmlrch.errupdrow = Erreur lors de la mise \u00E0 jour de la ligne\u00A0: {0}
xmlrch.chars = caract\u00E8res :
xmlrch.badvalue = Valeur incorrecte ; cette propri\u00E9t\u00E9 ne peut pas \u00EAtre NULL
xmlrch.badvalue1 = Valeur incorrecte ; ces m\u00E9tadonn\u00E9es ne peuvent pas \u00EAtre NULL
xmlrch.warning = ** Avertissement : {0} , ligne : {1} , URI : {2}
#RIOptimisticProvider Exceptions
riop.locking = Le verrouillage de la classification n'est pas pris en charge
#RIXMLProvider exceptions
rixml.unsupp = Non pris en charge avec RIXMLProvider

View file

@ -0,0 +1,170 @@
#
# Copyright (c) 2005, 2013, 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.
#
# CacheRowSetImpl exceptions
cachedrowsetimpl.populate = Oggetto ResultSet non valido fornito per l'inserimento dati nel metodo
cachedrowsetimpl.invalidp = Generato provider di persistenza non valido
cachedrowsetimpl.nullhash = Impossibile creare istanza CachedRowSetImpl. Tabella hash nulla fornita al costruttore
cachedrowsetimpl.invalidop = Operazione non valida nella riga di inserimento
cachedrowsetimpl.accfailed = acceptChanges non riuscito
cachedrowsetimpl.invalidcp = Posizione cursore non valida
cachedrowsetimpl.illegalop = Operazione non valida nella riga non inserita
cachedrowsetimpl.clonefail = Copia non riuscita: {0}
cachedrowsetimpl.invalidcol = Indice di colonna non valido
cachedrowsetimpl.invalcolnm = Nome di colonna non valido
cachedrowsetimpl.boolfail = getBoolen non riuscito per il valore ( {0} ) nella colonna {1}
cachedrowsetimpl.bytefail = getByte non riuscito per il valore ( {0} ) nella colonna {1}
cachedrowsetimpl.shortfail = getShort non riuscito per il valore ( {0} ) nella colonna {1}
cachedrowsetimpl.intfail = getInt non riuscito per il valore ( {0} ) nella colonna {1}
cachedrowsetimpl.longfail = getLong non riuscito per il valore ( {0} ) nella colonna {1}
cachedrowsetimpl.floatfail = getFloat non riuscito per il valore ( {0} ) nella colonna {1}
cachedrowsetimpl.doublefail = getDouble non riuscito per il valore ( {0} ) nella colonna {1}
cachedrowsetimpl.dtypemismt = Mancata corrispondenza tipo di dati
cachedrowsetimpl.datefail = getDate non riuscito per il valore ( {0} ) nella colonna {1}. Nessuna conversione disponibile.
cachedrowsetimpl.timefail = getTime non riuscito per il valore ( {0} ) nella colonna {1}. Nessuna conversione disponibile.
cachedrowsetimpl.posupdate = Aggiornamenti posizionati non supportati
cachedrowsetimpl.unableins = Impossibile creare istanza: {0}
cachedrowsetimpl.beforefirst = beforeFirst: operazione cursore non valida
cachedrowsetimpl.first = First: operazione cursore non valida
cachedrowsetimpl.last = last: TYPE_FORWARD_ONLY
cachedrowsetimpl.absolute = absolute: posizione cursore non valida
cachedrowsetimpl.relative = relative: posizione cursore non valida
cachedrowsetimpl.asciistream = lettura non riuscita per il flusso ascii
cachedrowsetimpl.binstream = lettura non riuscita per il flusso binario
cachedrowsetimpl.failedins = operazione non riuscita nella riga di inserimento
cachedrowsetimpl.updateins = updateRow chiamato nella riga di inserimento
cachedrowsetimpl.movetoins = moveToInsertRow: CONCUR_READ_ONLY
cachedrowsetimpl.movetoins1 = moveToInsertRow: nessun metadato
cachedrowsetimpl.movetoins2 = moveToInsertRow: numero di colonne non valido
cachedrowsetimpl.tablename = Il nome di tabella non pu\u00F2 essere nullo
cachedrowsetimpl.keycols = Colonne chiave non valide
cachedrowsetimpl.invalidcol = Indice di colonna non valido
cachedrowsetimpl.opnotsupp = Operazione non supportata dal database
cachedrowsetimpl.matchcols = Le colonne di corrispondenza non coincidono con le colonne impostate
cachedrowsetimpl.setmatchcols = Impostare le colonne di corrispondenza prima di recuperarle
cachedrowsetimpl.matchcols1 = Le colonne di corrispondenza devono essere superiori a 0
cachedrowsetimpl.matchcols2 = Le colonne di corrispondenza devono essere una stringa vuota o nulla
cachedrowsetimpl.unsetmatch = Le colonne rimosse non coincidono con le colonne impostate
cachedrowsetimpl.unsetmatch1 = Utilizzare il nome di colonna come argomento per unsetMatchColumn
cachedrowsetimpl.unsetmatch2 = Utilizzare l'ID di colonna come argomento per unsetMatchColumn
cachedrowsetimpl.numrows = Il numero di righe \u00E8 inferiore a zero o alla dimensione di recupero
cachedrowsetimpl.startpos = La posizione iniziale non pu\u00F2 essere negativa
cachedrowsetimpl.nextpage = Inserire i dati prima di chiamare
cachedrowsetimpl.pagesize = La dimensione della pagina non pu\u00F2 essere inferiore a zero
cachedrowsetimpl.pagesize1 = La dimensione della pagina non pu\u00F2 essere superiore a maxRows
cachedrowsetimpl.fwdonly = ResultSet \u00E8 a solo inoltro
cachedrowsetimpl.type = Il tipo \u00E8: {0}
cachedrowsetimpl.opnotysupp = Operazione attualmente non supportata
cachedrowsetimpl.featnotsupp = Funzione non supportata
# WebRowSetImpl exceptions
webrowsetimpl.nullhash = Impossibile creare istanza WebRowSetImpl. Tabella hash nulla fornita al costruttore
webrowsetimpl.invalidwr = Processo di scrittura non valido
webrowsetimpl.invalidrd = Processo di lettura non valido
#FilteredRowSetImpl exceptions
filteredrowsetimpl.relative = relative: operazione cursore non valida
filteredrowsetimpl.absolute = absolute: operazione cursore non valida
filteredrowsetimpl.notallowed = Questo valore non \u00E8 consentito nel filtro
#JoinRowSetImpl exceptions
joinrowsetimpl.notinstance = Non \u00E8 un'istanza di rowset
joinrowsetimpl.matchnotset = Colonna di corrispondenza non impostata per l'unione
joinrowsetimpl.numnotequal = Numero di elementi in rowset diverso dalla colonna di corrispondenza
joinrowsetimpl.notdefined = Non \u00E8 un tipo di unione definito
joinrowsetimpl.notsupported = Questo tipo di unione non \u00E8 supportato
joinrowsetimpl.initerror = Errore di inizializzazione di JoinRowSet
joinrowsetimpl.genericerr = Errore iniziale di joinrowset generico
joinrowsetimpl.emptyrowset = Impossibile aggiungere un set di righe vuoto al JoinRowSet corrente
#JdbcRowSetImpl exceptions
jdbcrowsetimpl.invalstate = Stato non valido
jdbcrowsetimpl.connect = JdbcRowSet (connessione): impossibile stabilire una connessione con JNDI
jdbcrowsetimpl.paramtype = Impossibile dedurre il tipo di parametro
jdbcrowsetimpl.matchcols = Le colonne di corrispondenza non coincidono con le colonne impostate
jdbcrowsetimpl.setmatchcols = Impostare le colonne di corrispondenza prima di recuperarle
jdbcrowsetimpl.matchcols1 = Le colonne di corrispondenza devono essere superiori a 0
jdbcrowsetimpl.matchcols2 = Le colonne di corrispondenza non possono essere una stringa vuota o nulla
jdbcrowsetimpl.unsetmatch = Le colonne rimosse non coincidono con le colonne impostate
jdbcrowsetimpl.usecolname = Utilizzare il nome di colonna come argomento per unsetMatchColumn
jdbcrowsetimpl.usecolid = Utilizzare l'ID di colonna come argomento per unsetMatchColumn
jdbcrowsetimpl.resnotupd = ResultSet non \u00E8 aggiornabile
jdbcrowsetimpl.opnotysupp = Operazione attualmente non supportata
jdbcrowsetimpl.featnotsupp = Funzione non supportata
#CachedRowSetReader exceptions
crsreader.connect = (JNDI) Impossibile stabilire una connessione
crsreader.paramtype = Impossibile dedurre il tipo di parametro
crsreader.connecterr = Errore interno in RowSetReader: nessuna connessione o comando
crsreader.datedetected = \u00C8 stata rilevata una data
crsreader.caldetected = \u00C8 stato rilevato un calendario
#CachedRowSetWriter exceptions
crswriter.connect = Impossibile stabilire una connessione
crswriter.tname = writeData non riesce a determinare il nome di tabella
crswriter.params1 = Valore dei parametri 1: {0}
crswriter.params2 = Valore dei parametri 2: {0}
crswriter.conflictsno = Conflitti durante la sincronizzazione
#InsertRow exceptions
insertrow.novalue = Non \u00E8 stato inserito alcun valore
#SyncResolverImpl exceptions
syncrsimpl.indexval = Valore indice non compreso nell'intervallo
syncrsimpl.noconflict = Questa colonna non \u00E8 in conflitto
syncrsimpl.syncnotpos = Impossibile eseguire la sincronizzazione
syncrsimpl.valtores = Il valore da risolvere pu\u00F2 essere nel database o in cachedrowset
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = Raggiunta la fine di RowSet. Posizione cursore non valida
wrsxmlreader.readxml = readXML: {0}
wrsxmlreader.parseerr = **Errore di analisi: {0}, riga: {1}, URI: {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException: {0}
wrsxmlwriter.sqlex = SQLException: {0}
wrsxmlwriter.failedwrite = Impossibile scrivere il valore
wsrxmlwriter.notproper = Non un tipo corretto
#XmlReaderContentHandler exceptions
xmlrch.errmap = Errore durante l''impostazione della mappa: {0}
xmlrch.errmetadata = Errore durante l''impostazione dei metadati: {0}
xmlrch.errinsertval = Errore durante l''inserimento dei valori: {0}
xmlrch.errconstr = Errore durante la costruzione della riga: {0}
xmlrch.errdel = Errore durante l''eliminazione della riga: {0}
xmlrch.errinsert = Errore durante la costruzione della riga di inserimento: {0}
xmlrch.errinsdel = Errore durante la costruzione della riga insdel: {0}
xmlrch.errupdate = Errore durante la costruzione della riga di aggiornamento: {0}
xmlrch.errupdrow = Errore durante l''aggiornamento della riga: {0}
xmlrch.chars = caratteri:
xmlrch.badvalue = valore non valido; propriet\u00E0 non annullabile
xmlrch.badvalue1 = valore non valido; metadati non annullabili
xmlrch.warning = **Avvertenza: {0}, riga: {1}, URI: {2}
#RIOptimisticProvider Exceptions
riop.locking = La classificazione di blocco non \u00E8 supportata
#RIXMLProvider exceptions
rixml.unsupp = Non supportato con RIXMLProvider

View file

@ -0,0 +1,170 @@
#
# Copyright (c) 2005, 2016, 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.
#
# CacheRowSetImpl exceptions
cachedrowsetimpl.populate = populate\u30E1\u30BD\u30C3\u30C9\u306B\u7121\u52B9\u306AResultSet\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C\u4F7F\u7528\u3055\u308C\u307E\u3057\u305F
cachedrowsetimpl.invalidp = \u7121\u52B9\u306A\u6C38\u7D9A\u6027\u30D7\u30ED\u30D0\u30A4\u30C0\u304C\u751F\u6210\u3055\u308C\u307E\u3057\u305F
cachedrowsetimpl.nullhash = CachedRowSetImpl\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5316\u3067\u304D\u307E\u305B\u3093\u3002\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306Bnull\u306EHashtable\u304C\u4F7F\u7528\u3055\u308C\u307E\u3057\u305F
cachedrowsetimpl.invalidop = \u633F\u5165\u884C\u3067\u306E\u7121\u52B9\u306A\u64CD\u4F5C
cachedrowsetimpl.accfailed = acceptChanges\u306E\u5931\u6557
cachedrowsetimpl.invalidcp = \u7121\u52B9\u306A\u30AB\u30FC\u30BD\u30EB\u4F4D\u7F6E
cachedrowsetimpl.illegalop = \u633F\u5165\u3055\u308C\u306A\u304B\u3063\u305F\u884C\u306E\u4E0D\u6B63\u306A\u64CD\u4F5C
cachedrowsetimpl.clonefail = \u30AF\u30ED\u30FC\u30F3\u306E\u5931\u6557: {0}
cachedrowsetimpl.invalidcol = \u7121\u52B9\u306A\u5217\u7D22\u5F15
cachedrowsetimpl.invalcolnm = \u7121\u52B9\u306A\u5217\u540D
cachedrowsetimpl.boolfail = \u5217{1}\u306E\u5024({0})\u3067getBoolean\u304C\u5931\u6557\u3057\u307E\u3057\u305F
cachedrowsetimpl.bytefail = \u5217{1}\u306E\u5024({0})\u3067getByte\u304C\u5931\u6557\u3057\u307E\u3057\u305F
cachedrowsetimpl.shortfail = \u5217{1}\u306E\u5024({0})\u3067getShort\u304C\u5931\u6557\u3057\u307E\u3057\u305F
cachedrowsetimpl.intfail = \u5217{1}\u306E\u5024({0})\u3067getInt\u304C\u5931\u6557\u3057\u307E\u3057\u305F
cachedrowsetimpl.longfail = \u5217{1}\u306E\u5024({0})\u3067getLong\u304C\u5931\u6557\u3057\u307E\u3057\u305F
cachedrowsetimpl.floatfail = \u5217{1}\u306E\u5024({0})\u3067getFloat\u304C\u5931\u6557\u3057\u307E\u3057\u305F
cachedrowsetimpl.doublefail = \u5217{1}\u306E\u5024({0})\u3067getDouble\u304C\u5931\u6557\u3057\u307E\u3057\u305F
cachedrowsetimpl.dtypemismt = \u30C7\u30FC\u30BF\u578B\u306E\u4E0D\u4E00\u81F4
cachedrowsetimpl.datefail = \u5217{1}\u306E\u5024({0})\u3067getDate\u304C\u5931\u6557\u3002\u5909\u63DB\u3067\u304D\u307E\u305B\u3093
cachedrowsetimpl.timefail = \u5217{1}\u306E\u5024({0})\u3067getTime\u304C\u5931\u6557\u3002\u5909\u63DB\u3067\u304D\u307E\u305B\u3093
cachedrowsetimpl.posupdate = \u4F4D\u7F6E\u6C7A\u3081\u3055\u308C\u305F\u66F4\u65B0\u304C\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u307E\u305B\u3093
cachedrowsetimpl.unableins = \u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5316\u3067\u304D\u306A\u3044: {0}
cachedrowsetimpl.beforefirst = beforeFirst: \u7121\u52B9\u306A\u30AB\u30FC\u30BD\u30EB\u64CD\u4F5C
cachedrowsetimpl.first = First: \u7121\u52B9\u306A\u30AB\u30FC\u30BD\u30EB\u64CD\u4F5C
cachedrowsetimpl.last = last: TYPE_FORWARD_ONLY
cachedrowsetimpl.absolute = absolute: \u7121\u52B9\u306A\u30AB\u30FC\u30BD\u30EB\u4F4D\u7F6E
cachedrowsetimpl.relative = relative: \u7121\u52B9\u306A\u30AB\u30FC\u30BD\u30EB\u4F4D\u7F6E
cachedrowsetimpl.asciistream = ascii\u30B9\u30C8\u30EA\u30FC\u30E0\u306E\u8AAD\u8FBC\u307F\u304C\u5931\u6557\u3057\u307E\u3057\u305F
cachedrowsetimpl.binstream = \u30D0\u30A4\u30CA\u30EA\u30FB\u30B9\u30C8\u30EA\u30FC\u30E0\u306E\u8AAD\u8FBC\u307F\u304C\u5931\u6557\u3057\u307E\u3057\u305F
cachedrowsetimpl.failedins = \u884C\u306E\u633F\u5165\u306B\u5931\u6557
cachedrowsetimpl.updateins = \u633F\u5165\u884C\u306B\u304A\u3044\u3066updateRow\u304C\u547C\u3073\u51FA\u3055\u308C\u307E\u3057\u305F
cachedrowsetimpl.movetoins = moveToInsertRow: CONCUR_READ_ONLY
cachedrowsetimpl.movetoins1 = moveToInsertRow: \u30E1\u30BF\u30C7\u30FC\u30BF\u306A\u3057
cachedrowsetimpl.movetoins2 = moveToInsertRow: \u7121\u52B9\u306A\u5217\u6570
cachedrowsetimpl.tablename = \u8868\u540D\u306Bnull\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
cachedrowsetimpl.keycols = \u7121\u52B9\u306A\u30AD\u30FC\u5217
cachedrowsetimpl.invalidcol = \u7121\u52B9\u306A\u5217\u7D22\u5F15
cachedrowsetimpl.opnotsupp = \u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u306A\u3044\u64CD\u4F5C
cachedrowsetimpl.matchcols = \u4E00\u81F4\u5217\u304C\u5217\u306E\u30BB\u30C3\u30C8\u3068\u540C\u3058\u3067\u306F\u3042\u308A\u307E\u305B\u3093
cachedrowsetimpl.setmatchcols = \u4E00\u81F4\u5217\u3092\u53D6\u5F97\u3059\u308B\u524D\u306B\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044
cachedrowsetimpl.matchcols1 = \u4E00\u81F4\u5217\u306F0\u3088\u308A\u5927\u304D\u3044\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
cachedrowsetimpl.matchcols2 = \u4E00\u81F4\u5217\u306F\u7A7A\u304Bnull\u6587\u5B57\u5217\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
cachedrowsetimpl.unsetmatch = \u8A2D\u5B9A\u89E3\u9664\u3055\u308C\u3066\u3044\u308B\u5217\u306F\u30BB\u30C3\u30C8\u3068\u540C\u3058\u3067\u306F\u3042\u308A\u307E\u305B\u3093
cachedrowsetimpl.unsetmatch1 = unsetMatchColumn\u3078\u306E\u5F15\u6570\u3068\u3057\u3066\u5217\u540D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
cachedrowsetimpl.unsetmatch2 = unsetMatchColumn\u3078\u306E\u5F15\u6570\u3068\u3057\u3066\u5217ID\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
cachedrowsetimpl.numrows = \u884C\u6570\u304C\u30BC\u30ED\u307E\u305F\u306F\u30D5\u30A7\u30C3\u30C1\u30FB\u30B5\u30A4\u30BA\u3088\u308A\u5C0F\u3055\u3044\u3067\u3059
cachedrowsetimpl.startpos = \u958B\u59CB\u4F4D\u7F6E\u3092\u8CA0\u306B\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
cachedrowsetimpl.nextpage = \u547C\u51FA\u3057\u524D\u306B\u30C7\u30FC\u30BF\u3092\u79FB\u5165\u3057\u307E\u3059
cachedrowsetimpl.pagesize = \u30DA\u30FC\u30B8\u30FB\u30B5\u30A4\u30BA\u3092\u30BC\u30ED\u3088\u308A\u5C0F\u3055\u304F\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
cachedrowsetimpl.pagesize1 = \u30DA\u30FC\u30B8\u30FB\u30B5\u30A4\u30BA\u3092maxRows\u3088\u308A\u5927\u304D\u304F\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
cachedrowsetimpl.fwdonly = ResultSet\u306F\u9806\u65B9\u5411\u306E\u307F\u3067\u3059
cachedrowsetimpl.type = \u30BF\u30A4\u30D7: {0}
cachedrowsetimpl.opnotysupp = \u307E\u3060\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044\u64CD\u4F5C
cachedrowsetimpl.featnotsupp = \u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044\u6A5F\u80FD
# WebRowSetImpl exceptions
webrowsetimpl.nullhash = WebRowSetImpl\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5316\u3067\u304D\u307E\u305B\u3093\u3002\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306Bnull\u306EHashtable\u304C\u4F7F\u7528\u3055\u308C\u307E\u3057\u305F
webrowsetimpl.invalidwr = \u7121\u52B9\u306A\u30E9\u30A4\u30BF\u30FC
webrowsetimpl.invalidrd = \u7121\u52B9\u306A\u30EA\u30FC\u30C0\u30FC
#FilteredRowSetImpl exceptions
filteredrowsetimpl.relative = relative: \u7121\u52B9\u306A\u30AB\u30FC\u30BD\u30EB\u64CD\u4F5C
filteredrowsetimpl.absolute = absolute: \u7121\u52B9\u306A\u30AB\u30FC\u30BD\u30EB\u64CD\u4F5C
filteredrowsetimpl.notallowed = \u3053\u306E\u5024\u306F\u30D5\u30A3\u30EB\u30BF\u3067\u8A31\u5BB9\u3055\u308C\u307E\u305B\u3093
#JoinRowSetImpl exceptions
joinrowsetimpl.notinstance = \u884C\u30BB\u30C3\u30C8\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093
joinrowsetimpl.matchnotset = \u4E00\u81F4\u5217\u304C\u7D50\u5408\u7528\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
joinrowsetimpl.numnotequal = \u884C\u30BB\u30C3\u30C8\u306E\u8981\u7D20\u6570\u304C\u4E00\u81F4\u5217\u3068\u7B49\u3057\u304F\u3042\u308A\u307E\u305B\u3093
joinrowsetimpl.notdefined = \u5B9A\u7FA9\u3055\u308C\u305F\u7D50\u5408\u306E\u30BF\u30A4\u30D7\u3067\u306F\u3042\u308A\u307E\u305B\u3093
joinrowsetimpl.notsupported = \u3053\u306E\u30BF\u30A4\u30D7\u306E\u7D50\u5408\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
joinrowsetimpl.initerror = JoinRowSet\u521D\u671F\u5316\u30A8\u30E9\u30FC
joinrowsetimpl.genericerr = \u6C4E\u7528joinrowset\u306E\u521D\u671F\u30A8\u30E9\u30FC
joinrowsetimpl.emptyrowset = \u3053\u306EJoinRowSet\u306B\u7A7A\u306E\u884C\u30BB\u30C3\u30C8\u3092\u8FFD\u52A0\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
#JdbcRowSetImpl exceptions
jdbcrowsetimpl.invalstate = \u7121\u52B9\u306A\u72B6\u614B
jdbcrowsetimpl.connect = JdbcRowSet (connect): JNDI\u304C\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093
jdbcrowsetimpl.paramtype = \u30D1\u30E9\u30E1\u30FC\u30BF\u30FB\u30BF\u30A4\u30D7\u3092\u63A8\u5B9A\u3067\u304D\u307E\u305B\u3093
jdbcrowsetimpl.matchcols = \u4E00\u81F4\u5217\u304C\u5217\u306E\u30BB\u30C3\u30C8\u3068\u540C\u3058\u3067\u306F\u3042\u308A\u307E\u305B\u3093
jdbcrowsetimpl.setmatchcols = \u4E00\u81F4\u5217\u3092\u53D6\u5F97\u3059\u308B\u524D\u306B\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044
jdbcrowsetimpl.matchcols1 = \u4E00\u81F4\u5217\u306F0\u3088\u308A\u5927\u304D\u3044\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
jdbcrowsetimpl.matchcols2 = \u4E00\u81F4\u5217\u3092\u7A7A\u307E\u305F\u306Fnull\u6587\u5B57\u5217\u306B\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
jdbcrowsetimpl.unsetmatch = \u8A2D\u5B9A\u89E3\u9664\u3055\u308C\u3066\u3044\u308B\u5217\u306F\u30BB\u30C3\u30C8\u3068\u540C\u3058\u3067\u306F\u3042\u308A\u307E\u305B\u3093
jdbcrowsetimpl.usecolname = unsetMatchColumn\u3078\u306E\u5F15\u6570\u3068\u3057\u3066\u5217\u540D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
jdbcrowsetimpl.usecolid = unsetMatchColumn\u3078\u306E\u5F15\u6570\u3068\u3057\u3066\u5217ID\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
jdbcrowsetimpl.resnotupd = ResultSet\u306F\u66F4\u65B0\u3067\u304D\u307E\u305B\u3093
jdbcrowsetimpl.opnotysupp = \u307E\u3060\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044\u64CD\u4F5C
jdbcrowsetimpl.featnotsupp = \u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044\u6A5F\u80FD
#CachedRowSetReader exceptions
crsreader.connect = (JNDI)\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093
crsreader.paramtype = \u30D1\u30E9\u30E1\u30FC\u30BF\u30FB\u30BF\u30A4\u30D7\u3092\u63A8\u5B9A\u3067\u304D\u307E\u305B\u3093
crsreader.connecterr = RowSetReader\u306E\u5185\u90E8\u30A8\u30E9\u30FC: \u63A5\u7D9A\u307E\u305F\u306F\u30B3\u30DE\u30F3\u30C9\u306A\u3057
crsreader.datedetected = \u65E5\u4ED8\u3092\u691C\u51FA\u3057\u307E\u3057\u305F
crsreader.caldetected = \u30AB\u30EC\u30F3\u30C0\u3092\u691C\u51FA\u3057\u307E\u3057\u305F
#CachedRowSetWriter exceptions
crswriter.connect = \u63A5\u7D9A\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093
crswriter.tname = writeData\u304C\u8868\u540D\u3092\u5224\u5225\u3067\u304D\u307E\u305B\u3093
crswriter.params1 = params1\u306E\u5024: {0}
crswriter.params2 = params2\u306E\u5024: {0}
crswriter.conflictsno = \u540C\u671F\u4E2D\u306B\u7AF6\u5408\u304C\u767A\u751F\u3057\u307E\u3059
#InsertRow exceptions
insertrow.novalue = \u5024\u306F\u633F\u5165\u3055\u308C\u3066\u3044\u307E\u305B\u3093
#SyncResolverImpl exceptions
syncrsimpl.indexval = \u7BC4\u56F2\u5916\u306E\u7D22\u5F15\u5024
syncrsimpl.noconflict = \u3053\u306E\u5217\u306F\u7AF6\u5408\u3057\u3066\u3044\u307E\u305B\u3093
syncrsimpl.syncnotpos = \u540C\u671F\u3067\u304D\u307E\u305B\u3093
syncrsimpl.valtores = \u89E3\u6C7A\u3055\u308C\u308B\u5024\u306F\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u307E\u305F\u306Fcachedrowset\u306B\u3042\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = RowSet\u306E\u6700\u5F8C\u306B\u5230\u9054\u3057\u307E\u3057\u305F\u3002\u7121\u52B9\u306A\u30AB\u30FC\u30BD\u30EB\u4F4D\u7F6E
wrsxmlreader.readxml = readXML: {0}
wrsxmlreader.parseerr = **\u89E3\u6790\u30A8\u30E9\u30FC: {0}\u3001\u884C: {1}\u3001URI: {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException: {0}
wrsxmlwriter.sqlex = SQLException: {0}
wrsxmlwriter.failedwrite = \u5024\u306E\u66F8\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F
wsrxmlwriter.notproper = \u9069\u5207\u306A\u30BF\u30A4\u30D7\u3067\u306F\u3042\u308A\u307E\u305B\u3093
#XmlReaderContentHandler exceptions
xmlrch.errmap = Map\u8A2D\u5B9A\u30A8\u30E9\u30FC: {0}
xmlrch.errmetadata = \u30E1\u30BF\u30C7\u30FC\u30BF\u8A2D\u5B9A\u30A8\u30E9\u30FC: {0}
xmlrch.errinsertval = \u5024\u306E\u633F\u5165\u30A8\u30E9\u30FC: {0}
xmlrch.errconstr = \u884C\u306E\u751F\u6210\u30A8\u30E9\u30FC: {0}
xmlrch.errdel = \u884C\u306E\u524A\u9664\u30A8\u30E9\u30FC: {0}
xmlrch.errinsert = \u633F\u5165\u884C\u306E\u751F\u6210\u30A8\u30E9\u30FC: {0}
xmlrch.errinsdel = insdel\u884C\u306E\u751F\u6210\u30A8\u30E9\u30FC: {0}
xmlrch.errupdate = \u66F4\u65B0\u884C\u306E\u751F\u6210\u30A8\u30E9\u30FC: {0}
xmlrch.errupdrow = \u884C\u306E\u66F4\u65B0\u30A8\u30E9\u30FC: {0}
xmlrch.chars = \u6587\u5B57:
xmlrch.badvalue = \u4E0D\u6B63\u306A\u5024: null\u306B\u3067\u304D\u306A\u3044\u30D7\u30ED\u30D1\u30C6\u30A3
xmlrch.badvalue1 = \u4E0D\u6B63\u306A\u5024: null\u306B\u3067\u304D\u306A\u3044\u30E1\u30BF\u30C7\u30FC\u30BF
xmlrch.warning = **\u8B66\u544A: {0}\u3001\u884C: {1}\u3001URI: {2}
#RIOptimisticProvider Exceptions
riop.locking = \u30ED\u30C3\u30AF\u306E\u5206\u985E\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
#RIXMLProvider exceptions
rixml.unsupp = RIXMLProvider\u3067\u306F\u672A\u30B5\u30DD\u30FC\u30C8

View file

@ -0,0 +1,170 @@
#
# Copyright (c) 2005, 2017, 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.
#
# CacheRowSetImpl exceptions
cachedrowsetimpl.populate = \uBD80\uC801\uD569\uD55C ResultSet \uAC1D\uCCB4\uAC00 \uC81C\uACF5\uB418\uC5B4 \uBA54\uC18C\uB4DC\uB97C \uCC44\uC6B8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.invalidp = \uBD80\uC801\uD569\uD55C \uC9C0\uC18D\uC131 \uC81C\uACF5\uC790\uAC00 \uC0DD\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.nullhash = CachedRowSetImpl \uC778\uC2A4\uD134\uC2A4\uB97C \uC778\uC2A4\uD134\uC2A4\uD654\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC0DD\uC131\uC790\uC5D0 \uB110 Hashtable\uC774 \uC81C\uACF5\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.invalidop = \uD589\uC744 \uC0BD\uC785\uD558\uB294 \uC911 \uBD80\uC801\uD569\uD55C \uC791\uC5C5\uC774 \uC218\uD589\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.accfailed = acceptChanges\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.invalidcp = \uCEE4\uC11C \uC704\uCE58\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
cachedrowsetimpl.illegalop = \uC0BD\uC785\uB41C \uD589\uC774 \uC544\uB2CC \uD589\uC5D0\uC11C \uC798\uBABB\uB41C \uC791\uC5C5\uC774 \uC218\uD589\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.clonefail = \uBCF5\uC81C \uC2E4\uD328: {0}
cachedrowsetimpl.invalidcol = \uC5F4 \uC778\uB371\uC2A4\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
cachedrowsetimpl.invalcolnm = \uC5F4 \uC774\uB984\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
cachedrowsetimpl.boolfail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getBoolen\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.bytefail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getByte\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.shortfail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getShort\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.intfail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getInt\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.longfail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getLong\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.floatfail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getFloat\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.doublefail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getDouble\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.dtypemismt = \uB370\uC774\uD130 \uC720\uD615\uC774 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.datefail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getDate\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \uBCC0\uD658\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.timefail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getTime\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \uBCC0\uD658\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.posupdate = \uC704\uCE58\uAC00 \uC9C0\uC815\uB41C \uC5C5\uB370\uC774\uD2B8\uAC00 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.unableins = \uC778\uC2A4\uD134\uC2A4\uD654\uD560 \uC218 \uC5C6\uC74C: {0}
cachedrowsetimpl.beforefirst = beforeFirst: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
cachedrowsetimpl.first = \uCC98\uC74C: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
cachedrowsetimpl.last = \uB9C8\uC9C0\uB9C9: TYPE_FORWARD_ONLY
cachedrowsetimpl.absolute = \uC808\uB300: \uCEE4\uC11C \uC704\uCE58\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
cachedrowsetimpl.relative = \uC0C1\uB300: \uCEE4\uC11C \uC704\uCE58\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
cachedrowsetimpl.asciistream = ASCII \uC2A4\uD2B8\uB9BC\uC5D0 \uB300\uD55C \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.binstream = \uBC14\uC774\uB108\uB9AC \uC2A4\uD2B8\uB9BC\uC5D0\uC11C \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.failedins = \uD589 \uC0BD\uC785\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.updateins = \uD589\uC744 \uC0BD\uC785\uD558\uB294 \uC911 updateRow\uAC00 \uD638\uCD9C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.movetoins = moveToInsertRow: CONCUR_READ_ONLY
cachedrowsetimpl.movetoins1 = moveToInsertRow: \uBA54\uD0C0\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.movetoins2 = moveToInsertRow: \uC5F4 \uC218\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
cachedrowsetimpl.tablename = \uD14C\uC774\uBE14 \uC774\uB984\uC740 \uB110\uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.keycols = \uD0A4 \uC5F4\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
cachedrowsetimpl.invalidcol = \uC5F4 \uC778\uB371\uC2A4\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
cachedrowsetimpl.opnotsupp = \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC5D0\uC11C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC791\uC5C5\uC785\uB2C8\uB2E4.
cachedrowsetimpl.matchcols = \uC77C\uCE58 \uC5F4\uC774 \uC124\uC815\uB41C \uC5F4\uACFC \uB3D9\uC77C\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.setmatchcols = \uC77C\uCE58 \uC5F4\uC744 \uC124\uC815\uD55C \uD6C4 \uAC00\uC838\uC624\uC2ED\uC2DC\uC624.
cachedrowsetimpl.matchcols1 = \uC77C\uCE58 \uC5F4\uC740 0\uAC1C \uC774\uC0C1\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
cachedrowsetimpl.matchcols2 = \uC77C\uCE58 \uC5F4\uC740 \uBE44\uC5B4 \uC788\uAC70\uB098 \uB110 \uBB38\uC790\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
cachedrowsetimpl.unsetmatch = \uC124\uC815\uC744 \uD574\uC81C\uD558\uB824\uB294 \uC5F4\uC774 \uC124\uC815\uB41C \uC5F4\uACFC \uB2E4\uB985\uB2C8\uB2E4.
cachedrowsetimpl.unsetmatch1 = \uC5F4 \uC774\uB984\uC744 unsetMatchColumn\uC758 \uC778\uC218\uB85C \uC0AC\uC6A9\uD558\uC2ED\uC2DC\uC624.
cachedrowsetimpl.unsetmatch2 = \uC5F4 ID\uB97C unsetMatchColumn\uC758 \uC778\uC218\uB85C \uC0AC\uC6A9\uD558\uC2ED\uC2DC\uC624.
cachedrowsetimpl.numrows = \uD589 \uC218\uAC00 0\uBCF4\uB2E4 \uC791\uAC70\uB098 \uC778\uCD9C \uD06C\uAE30\uBCF4\uB2E4 \uC791\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.startpos = \uC2DC\uC791 \uC704\uCE58\uB294 \uC74C\uC218\uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.nextpage = \uD638\uCD9C\uD558\uAE30 \uC804\uC5D0 \uB370\uC774\uD130\uB97C \uCC44\uC6B0\uC2ED\uC2DC\uC624.
cachedrowsetimpl.pagesize = \uD398\uC774\uC9C0 \uD06C\uAE30\uB294 0\uBCF4\uB2E4 \uC791\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.pagesize1 = \uD398\uC774\uC9C0 \uD06C\uAE30\uB294 maxRows\uBCF4\uB2E4 \uD074 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.fwdonly = ResultSet\uB294 \uC804\uB2EC \uC804\uC6A9\uC785\uB2C8\uB2E4.
cachedrowsetimpl.type = \uC720\uD615: {0}
cachedrowsetimpl.opnotysupp = \uC791\uC5C5\uC774 \uC544\uC9C1 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
cachedrowsetimpl.featnotsupp = \uAE30\uB2A5\uC774 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
# WebRowSetImpl exceptions
webrowsetimpl.nullhash = WebRowSetImpl \uC778\uC2A4\uD134\uC2A4\uB97C \uC778\uC2A4\uD134\uC2A4\uD654\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC0DD\uC131\uC790\uC5D0 \uB110 Hashtable\uC774 \uC81C\uACF5\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
webrowsetimpl.invalidwr = \uAE30\uB85D \uC7A5\uCE58\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
webrowsetimpl.invalidrd = \uC77D\uAE30 \uD504\uB85C\uADF8\uB7A8\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
#FilteredRowSetImpl exceptions
filteredrowsetimpl.relative = \uC0C1\uB300: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
filteredrowsetimpl.absolute = \uC808\uB300: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
filteredrowsetimpl.notallowed = \uC774 \uAC12\uC740 \uD544\uD130\uB97C \uD1B5\uACFC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
#JoinRowSetImpl exceptions
joinrowsetimpl.notinstance = Rowset\uC758 \uC778\uC2A4\uD134\uC2A4\uAC00 \uC544\uB2D9\uB2C8\uB2E4.
joinrowsetimpl.matchnotset = \uC870\uC778\uD560 \uC77C\uCE58 \uC5F4\uC774 \uC124\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
joinrowsetimpl.numnotequal = Rowset\uC758 \uC694\uC18C \uC218\uAC00 \uC77C\uCE58 \uC5F4\uACFC \uAC19\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
joinrowsetimpl.notdefined = \uC815\uC758\uB41C \uC870\uC778 \uC720\uD615\uC774 \uC544\uB2D9\uB2C8\uB2E4.
joinrowsetimpl.notsupported = \uC774 \uC870\uC778 \uC720\uD615\uC740 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
joinrowsetimpl.initerror = JoinRowSet \uCD08\uAE30\uD654 \uC624\uB958
joinrowsetimpl.genericerr = \uC77C\uBC18 joinrowset \uCD08\uAE30 \uC624\uB958
joinrowsetimpl.emptyrowset = \uBE48 rowset\uB97C \uC774 JoinRowSet\uC5D0 \uCD94\uAC00\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
#JdbcRowSetImpl exceptions
jdbcrowsetimpl.invalstate = \uC0C1\uD0DC\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
jdbcrowsetimpl.connect = JdbcRowSet(\uC811\uC18D) JNDI\uAC00 \uC811\uC18D\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
jdbcrowsetimpl.paramtype = \uB9E4\uAC1C\uBCC0\uC218 \uC720\uD615\uC744 \uCD94\uB860\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
jdbcrowsetimpl.matchcols = \uC77C\uCE58 \uC5F4\uC774 \uC124\uC815\uB41C \uC5F4\uACFC \uB3D9\uC77C\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
jdbcrowsetimpl.setmatchcols = \uC77C\uCE58 \uC5F4\uC744 \uC124\uC815\uD55C \uD6C4 \uAC00\uC838\uC624\uC2ED\uC2DC\uC624.
jdbcrowsetimpl.matchcols1 = \uC77C\uCE58 \uC5F4\uC740 0\uAC1C \uC774\uC0C1\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
jdbcrowsetimpl.matchcols2 = \uC77C\uCE58 \uC5F4\uC740 \uB110 \uB610\uB294 \uBE48 \uBB38\uC790\uC5F4\uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
jdbcrowsetimpl.unsetmatch = \uC124\uC815\uC744 \uD574\uC81C\uD558\uB824\uB294 \uC5F4\uC774 \uC124\uC815\uB41C \uC5F4\uACFC \uB2E4\uB985\uB2C8\uB2E4.
jdbcrowsetimpl.usecolname = \uC5F4 \uC774\uB984\uC744 unsetMatchColumn\uC758 \uC778\uC218\uB85C \uC0AC\uC6A9\uD558\uC2ED\uC2DC\uC624.
jdbcrowsetimpl.usecolid = \uC5F4 ID\uB97C unsetMatchColumn\uC758 \uC778\uC218\uB85C \uC0AC\uC6A9\uD558\uC2ED\uC2DC\uC624.
jdbcrowsetimpl.resnotupd = ResultSet\uB97C \uC5C5\uB370\uC774\uD2B8\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
jdbcrowsetimpl.opnotysupp = \uC791\uC5C5\uC774 \uC544\uC9C1 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
jdbcrowsetimpl.featnotsupp = \uAE30\uB2A5\uC774 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
#CachedRowSetReader exceptions
crsreader.connect = (JNDI) \uC811\uC18D\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
crsreader.paramtype = \uB9E4\uAC1C\uBCC0\uC218 \uC720\uD615\uC744 \uCD94\uB860\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
crsreader.connecterr = RowSetReader\uC5D0 \uB0B4\uBD80 \uC624\uB958 \uBC1C\uC0DD: \uC811\uC18D \uB610\uB294 \uBA85\uB839\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
crsreader.datedetected = \uB0A0\uC9DC\uB97C \uAC10\uC9C0\uD568
crsreader.caldetected = \uB2EC\uB825\uC744 \uAC10\uC9C0\uD568
#CachedRowSetWriter exceptions
crswriter.connect = \uC811\uC18D\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
crswriter.tname = writeData\uC5D0\uC11C \uD14C\uC774\uBE14 \uC774\uB984\uC744 \uD655\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
crswriter.params1 = params1\uC758 \uAC12: {0}
crswriter.params2 = params2\uC758 \uAC12: {0}
crswriter.conflictsno = \uB3D9\uAE30\uD654\uD558\uB294 \uC911 \uCDA9\uB3CC\uD568
#InsertRow exceptions
insertrow.novalue = \uAC12\uC774 \uC0BD\uC785\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
#SyncResolverImpl exceptions
syncrsimpl.indexval = \uC778\uB371\uC2A4 \uAC12\uC774 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4.
syncrsimpl.noconflict = \uC774 \uC5F4\uC740 \uCDA9\uB3CC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
syncrsimpl.syncnotpos = \uB3D9\uAE30\uD654\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
syncrsimpl.valtores = \uBD84\uC11D\uD560 \uAC12\uC774 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uB610\uB294 cachedrowset\uC5D0 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4.
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = RowSet\uC758 \uB05D\uC5D0 \uB3C4\uB2EC\uD588\uC2B5\uB2C8\uB2E4. \uCEE4\uC11C \uC704\uCE58\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
wrsxmlreader.readxml = readXML: {0}
wrsxmlreader.parseerr = ** \uAD6C\uBB38\uBD84\uC11D \uC624\uB958: {0}, \uD589: {1}, URI: {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException : {0}
wrsxmlwriter.sqlex = SQLException : {0}
wrsxmlwriter.failedwrite = \uAC12 \uC4F0\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
wsrxmlwriter.notproper = \uC801\uC808\uD55C \uC720\uD615\uC774 \uC544\uB2D9\uB2C8\uB2E4.
#XmlReaderContentHandler exceptions
xmlrch.errmap = \uB9F5\uC744 \uC124\uC815\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0}
xmlrch.errmetadata = \uBA54\uD0C0\uB370\uC774\uD130\uB97C \uC124\uC815\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0}
xmlrch.errinsertval = \uAC12\uC744 \uC0BD\uC785\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0}
xmlrch.errconstr = \uD589\uC744 \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0}
xmlrch.errdel = \uD589\uC744 \uC0AD\uC81C\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0}
xmlrch.errinsert = insert \uD589\uC744 \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0}
xmlrch.errinsdel = insdel \uD589\uC744 \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0}
xmlrch.errupdate = update \uD589\uC744 \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0}
xmlrch.errupdrow = \uD589\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0}
xmlrch.chars = \uBB38\uC790:
xmlrch.badvalue = \uC798\uBABB\uB41C \uAC12: \uB110\uC77C \uC218 \uC5C6\uB294 \uC18D\uC131\uC785\uB2C8\uB2E4.
xmlrch.badvalue1 = \uC798\uBABB\uB41C \uAC12: \uB110\uC77C \uC218 \uC5C6\uB294 \uBA54\uD0C0\uB370\uC774\uD130\uC785\uB2C8\uB2E4.
xmlrch.warning = ** \uACBD\uACE0: {0}, \uD589: {1}, URI: {2}
#RIOptimisticProvider Exceptions
riop.locking = \uBD84\uB958 \uC7A0\uAE08\uC774 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
#RIXMLProvider exceptions
rixml.unsupp = RIXMLProvider\uC5D0\uC11C \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.

View file

@ -0,0 +1,170 @@
#
# Copyright (c) 2005, 2016, 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.
#
# CacheRowSetImpl exceptions
cachedrowsetimpl.populate = Objeto ResultSet inv\u00E1lido fornecido para preencher o m\u00E9todo
cachedrowsetimpl.invalidp = Fornecedor de persist\u00EAncias inv\u00E1lido gerado
cachedrowsetimpl.nullhash = N\u00E3o \u00E9 poss\u00EDvel instanciar a inst\u00E2ncia CachedRowSetImpl. Hashtable Nulo fornecido ao construtor
cachedrowsetimpl.invalidop = Opera\u00E7\u00E3o inv\u00E1lida durante a inser\u00E7\u00E3o de linha
cachedrowsetimpl.accfailed = Falha em acceptChanges
cachedrowsetimpl.invalidcp = Posi\u00E7\u00E3o inv\u00E1lida do cursor
cachedrowsetimpl.illegalop = Opera\u00E7\u00E3o inv\u00E1lida em linha n\u00E3o inserida
cachedrowsetimpl.clonefail = Falha ao clonar: {0}
cachedrowsetimpl.invalidcol = \u00CDndice de coluna inv\u00E1lido
cachedrowsetimpl.invalcolnm = Nome de coluna inv\u00E1lido
cachedrowsetimpl.boolfail = Falha em getBoolen no valor ( {0} ) na coluna {1}
cachedrowsetimpl.bytefail = Falha em getByte no valor ( {0} ) na coluna {1}
cachedrowsetimpl.shortfail = Falha em getShort no valor ( {0} ) na coluna {1}
cachedrowsetimpl.intfail = Falha em getInt no valor ( {0} ) na coluna {1}
cachedrowsetimpl.longfail = Falha em getLong no valor ( {0} ) na coluna {1}
cachedrowsetimpl.floatfail = Falha em getFloat no valor ( {0} ) na coluna {1}
cachedrowsetimpl.doublefail = Falha em getDouble no valor ( {0} ) na coluna {1}
cachedrowsetimpl.dtypemismt = Tipo de Dados Incompat\u00EDvel
cachedrowsetimpl.datefail = Falha em getDate no valor ( {0} ) na coluna {1} sem convers\u00E3o dispon\u00EDvel
cachedrowsetimpl.timefail = Falha em getTime no valor ( {0} ) na coluna {1} sem convers\u00E3o dispon\u00EDvel
cachedrowsetimpl.posupdate = Atualiza\u00E7\u00F5es posicionadas n\u00E3o suportadas
cachedrowsetimpl.unableins = N\u00E3o \u00E9 poss\u00EDvel instanciar : {0}
cachedrowsetimpl.beforefirst = beforeFirst : Opera\u00E7\u00E3o do cursor inv\u00E1lida
cachedrowsetimpl.first = First : Opera\u00E7\u00E3o inv\u00E1lida do cursor
cachedrowsetimpl.last = last : TYPE_FORWARD_ONLY
cachedrowsetimpl.absolute = absolute : Posi\u00E7\u00E3o inv\u00E1lida do cursor
cachedrowsetimpl.relative = relative : Posi\u00E7\u00E3o inv\u00E1lida do cursor
cachedrowsetimpl.asciistream = falha na leitura do fluxo ascii
cachedrowsetimpl.binstream = falha na leitura do fluxo bin\u00E1rio
cachedrowsetimpl.failedins = Falha ao inserir a linha
cachedrowsetimpl.updateins = updateRow chamado durante a inser\u00E7\u00E3o de linha
cachedrowsetimpl.movetoins = moveToInsertRow : CONCUR_READ_ONLY
cachedrowsetimpl.movetoins1 = moveToInsertRow : sem metadados
cachedrowsetimpl.movetoins2 = moveToInsertRow : n\u00FAmero de colunas inv\u00E1lido
cachedrowsetimpl.tablename = O nome da tabela n\u00E3o pode ser nulo
cachedrowsetimpl.keycols = Colunas de chaves inv\u00E1lidas
cachedrowsetimpl.invalidcol = \u00CDndice de coluna inv\u00E1lido
cachedrowsetimpl.opnotsupp = Opera\u00E7\u00E3o n\u00E3o suportada pelo Banco de Dados
cachedrowsetimpl.matchcols = As colunas correspondentes n\u00E3o s\u00E3o iguais \u00E0s colunas definidas
cachedrowsetimpl.setmatchcols = Definir Colunas correspondentes antes de obt\u00EA-las
cachedrowsetimpl.matchcols1 = As colunas correspondentes devem ser maior do que 0
cachedrowsetimpl.matchcols2 = As colunas correspondentes devem ser strings vazias ou nulas
cachedrowsetimpl.unsetmatch = As colunas n\u00E3o definidas n\u00E3o s\u00E3o iguais \u00E0s colunas definidas
cachedrowsetimpl.unsetmatch1 = Usar o nome da coluna como argumento para unsetMatchColumn
cachedrowsetimpl.unsetmatch2 = Usar o ID da coluna como argumento para unsetMatchColumn
cachedrowsetimpl.numrows = O n\u00FAmero de linhas \u00E9 menor do que zero ou menor do que o tamanho obtido
cachedrowsetimpl.startpos = A posi\u00E7\u00E3o de in\u00EDcio n\u00E3o pode ser negativa
cachedrowsetimpl.nextpage = Preencher dados antes de chamar
cachedrowsetimpl.pagesize = O tamanho da p\u00E1gina n\u00E3o pode ser menor do que zero
cachedrowsetimpl.pagesize1 = O tamanho da p\u00E1gina n\u00E3o pode ser maior do que maxRows
cachedrowsetimpl.fwdonly = ResultSet \u00E9 somente para frente
cachedrowsetimpl.type = O tipo \u00E9 : {0}
cachedrowsetimpl.opnotysupp = Opera\u00E7\u00E3o ainda n\u00E3o suportada
cachedrowsetimpl.featnotsupp = Recurso n\u00E3o suportado
# WebRowSetImpl exceptions
webrowsetimpl.nullhash = N\u00E3o \u00E9 poss\u00EDvel instanciar a inst\u00E2ncia WebRowSetImpl. Hashtable nulo fornecido ao construtor
webrowsetimpl.invalidwr = Gravador inv\u00E1lido
webrowsetimpl.invalidrd = Leitor inv\u00E1lido
#FilteredRowSetImpl exceptions
filteredrowsetimpl.relative = relative : Opera\u00E7\u00E3o inv\u00E1lida do cursor
filteredrowsetimpl.absolute = absolute : Opera\u00E7\u00E3o inv\u00E1lida do cursor
filteredrowsetimpl.notallowed = Este valor n\u00E3o \u00E9 permitido no filtro
#JoinRowSetImpl exceptions
joinrowsetimpl.notinstance = N\u00E3o \u00E9 uma inst\u00E2ncia do conjunto de linhas
joinrowsetimpl.matchnotset = Coluna Correspondente n\u00E3o definida para jun\u00E7\u00E3o
joinrowsetimpl.numnotequal = N\u00FAmero de elementos no conjunto de linhas diferente da coluna correspondente
joinrowsetimpl.notdefined = N\u00E3o \u00E9 um tipo definido de jun\u00E7\u00E3o
joinrowsetimpl.notsupported = Este tipo de jun\u00E7\u00E3o n\u00E3o \u00E9 suportada
joinrowsetimpl.initerror = Erro de inicializa\u00E7\u00E3o do JoinRowSet
joinrowsetimpl.genericerr = Erro inicial de joinrowset gen\u00E9rico
joinrowsetimpl.emptyrowset = O conjunto de linha vazio n\u00E3o pode ser adicionado a este JoinRowSet
#JdbcRowSetImpl exceptions
jdbcrowsetimpl.invalstate = Estado inv\u00E1lido
jdbcrowsetimpl.connect = N\u00E3o \u00E9 poss\u00EDvel conectar JdbcRowSet (connect) a JNDI
jdbcrowsetimpl.paramtype = N\u00E3o \u00E9 poss\u00EDvel deduzir o tipo de par\u00E2metro
jdbcrowsetimpl.matchcols = As Colunas Correspondentes n\u00E3o s\u00E3o iguais \u00E0s colunas definidas
jdbcrowsetimpl.setmatchcols = Definir as colunas correspondentes antes de obt\u00EA-las
jdbcrowsetimpl.matchcols1 = As colunas correspondentes devem ser maior do que 0
jdbcrowsetimpl.matchcols2 = As colunas correspondentes n\u00E3o podem ser strings vazias ou nulas
jdbcrowsetimpl.unsetmatch = As colunas n\u00E3o definidas n\u00E3o s\u00E3o iguais \u00E0s colunas definidas
jdbcrowsetimpl.usecolname = Usar o nome da coluna como argumento para unsetMatchColumn
jdbcrowsetimpl.usecolid = Usar o ID da coluna como argumento para unsetMatchColumn
jdbcrowsetimpl.resnotupd = ResultSet n\u00E3o \u00E9 atualiz\u00E1vel
jdbcrowsetimpl.opnotysupp = Opera\u00E7\u00E3o ainda n\u00E3o suportada
jdbcrowsetimpl.featnotsupp = Recurso n\u00E3o suportado
#CachedRowSetReader exceptions
crsreader.connect = (JNDI) N\u00E3o \u00E9 poss\u00EDvel conectar
crsreader.paramtype = N\u00E3o \u00E9 poss\u00EDvel deduzir o tipo de par\u00E2metro
crsreader.connecterr = Erro Interno no RowSetReader: sem conex\u00E3o ou comando
crsreader.datedetected = Data Detectada
crsreader.caldetected = Calend\u00E1rio Detectado
#CachedRowSetWriter exceptions
crswriter.connect = N\u00E3o \u00E9 poss\u00EDvel obter a conex\u00E3o
crswriter.tname = writeData n\u00E3o pode determinar o nome da tabela
crswriter.params1 = Valor de params1 : {0}
crswriter.params2 = Valor de params2 : {0}
crswriter.conflictsno = conflitos durante a sincroniza\u00E7\u00E3o
#InsertRow exceptions
insertrow.novalue = Nenhum valor foi inserido
#SyncResolverImpl exceptions
syncrsimpl.indexval = Valor de \u00EDndice fora da faixa
syncrsimpl.noconflict = Est\u00E1 coluna n\u00E3o est\u00E1 em conflito
syncrsimpl.syncnotpos = A sincroniza\u00E7\u00E3o n\u00E3o \u00E9 poss\u00EDvel
syncrsimpl.valtores = O valor a ser decidido pode estar no banco de dados ou no conjunto de linhas armazenado no cache
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = Fim de RowSet atingido. Posi\u00E7\u00E3o inv\u00E1lida do cursor
wrsxmlreader.readxml = readXML : {0}
wrsxmlreader.parseerr = ** Erro de Parsing : {0} , linha : {1} , uri : {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException : {0}
wrsxmlwriter.sqlex = SQLException : {0}
wrsxmlwriter.failedwrite = Falha ao gravar o valor
wsrxmlwriter.notproper = N\u00E3o \u00E9 um tipo adequado
#XmlReaderContentHandler exceptions
xmlrch.errmap = Erro ao definir o Mapa : {0}
xmlrch.errmetadata = Erro ao definir metadados : {0}
xmlrch.errinsertval = Erro ao inserir valores : {0}
xmlrch.errconstr = Erro ao construir a linha : {0}
xmlrch.errdel = Erro ao excluir a linha : {0}
xmlrch.errinsert = Erro ao construir a linha de inser\u00E7\u00E3o : {0}
xmlrch.errinsdel = Erro ao construir a linha insdel : {0}
xmlrch.errupdate = Erro ao construir a linha de atualiza\u00E7\u00E3o : {0}
xmlrch.errupdrow = Erro ao atualizar a linha : {0}
xmlrch.chars = caracteres :
xmlrch.badvalue = Valor incorreto ; propriedade n\u00E3o anul\u00E1vel
xmlrch.badvalue1 = Valor incorreto ; metadado n\u00E3o anul\u00E1vel
xmlrch.warning = ** Advert\u00EAncia : {0} , linha : {1} , uri : {2}
#RIOptimisticProvider Exceptions
riop.locking = O bloqueio de classifica\u00E7\u00E3o n\u00E3o \u00E9 suportado
#RIXMLProvider exceptions
rixml.unsupp = N\u00E3o suportado com RIXMLProvider

View file

@ -0,0 +1,170 @@
#
# Copyright (c) 2005, 2017, 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.
#
# CacheRowSetImpl exceptions
cachedrowsetimpl.populate = Ifyllningsmetoden fick ett ogiltigt ResultSet-objekt
cachedrowsetimpl.invalidp = En ogiltig best\u00E4ndig leverant\u00F6r genererades
cachedrowsetimpl.nullhash = Kan inte instansiera CachedRowSetImpl. Null-hashtabell skickades till konstruktor
cachedrowsetimpl.invalidop = En ogiltig \u00E5tg\u00E4rd utf\u00F6rdes p\u00E5 infogad rad
cachedrowsetimpl.accfailed = acceptChanges utf\u00F6rdes inte
cachedrowsetimpl.invalidcp = Ogiltigt mark\u00F6rl\u00E4ge
cachedrowsetimpl.illegalop = En otill\u00E5ten \u00E5tg\u00E4rd utf\u00F6rdes p\u00E5 en icke infogad rad
cachedrowsetimpl.clonefail = Kloningen utf\u00F6rdes inte: {0}
cachedrowsetimpl.invalidcol = Ogiltigt kolumnindex
cachedrowsetimpl.invalcolnm = Ogiltigt kolumnnamn
cachedrowsetimpl.boolfail = getBoolen utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1}
cachedrowsetimpl.bytefail = getByte utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1}
cachedrowsetimpl.shortfail = getShort utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1}
cachedrowsetimpl.intfail = getInt utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1}
cachedrowsetimpl.longfail = getLong utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1}
cachedrowsetimpl.floatfail = getFloat utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1}
cachedrowsetimpl.doublefail = getDouble utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1}
cachedrowsetimpl.dtypemismt = Felmatchad datatyp
cachedrowsetimpl.datefail = getDate utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1}, ingen konvertering tillg\u00E4nglig
cachedrowsetimpl.timefail = getTime utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1}, ingen konvertering tillg\u00E4nglig
cachedrowsetimpl.posupdate = Det finns inte st\u00F6d f\u00F6r positionerad uppdatering
cachedrowsetimpl.unableins = Kan inte instansiera {0}
cachedrowsetimpl.beforefirst = beforeFirst: Ogiltig mark\u00F6r\u00E5tg\u00E4rd
cachedrowsetimpl.first = First: Ogiltig mark\u00F6r\u00E5tg\u00E4rd
cachedrowsetimpl.last = last: TYPE_FORWARD_ONLY
cachedrowsetimpl.absolute = absolute: Mark\u00F6rpositionen \u00E4r ogiltig
cachedrowsetimpl.relative = relative: Mark\u00F6rpositionen \u00E4r ogiltig
cachedrowsetimpl.asciistream = kunde inte l\u00E4sa ASCII-str\u00F6mmen
cachedrowsetimpl.binstream = kunde inte l\u00E4sa den bin\u00E4ra str\u00F6mmen
cachedrowsetimpl.failedins = Kunde inte infoga rad
cachedrowsetimpl.updateins = updateRow anropades fr\u00E5n infogad rad
cachedrowsetimpl.movetoins = moveToInsertRow : CONCUR_READ_ONLY
cachedrowsetimpl.movetoins1 = moveToInsertRow: inga metadata
cachedrowsetimpl.movetoins2 = moveToInsertRow: ogiltigt antal kolumner
cachedrowsetimpl.tablename = Tabellnamnet kan inte vara null
cachedrowsetimpl.keycols = Ogiltiga nyckelkolumner
cachedrowsetimpl.invalidcol = Ogiltigt kolumnindex
cachedrowsetimpl.opnotsupp = Databasen har inte st\u00F6d f\u00F6r denna \u00E5tg\u00E4rd
cachedrowsetimpl.matchcols = Matchningskolumnerna \u00E4r inte samma som de som st\u00E4llts in
cachedrowsetimpl.setmatchcols = St\u00E4ll in matchningskolumnerna innan du h\u00E4mtar dem
cachedrowsetimpl.matchcols1 = Matchningskolumnerna m\u00E5ste vara st\u00F6rre \u00E4n 0
cachedrowsetimpl.matchcols2 = Matchningskolumnerna m\u00E5ste vara tomma eller en null-str\u00E4ng
cachedrowsetimpl.unsetmatch = Kolumnerna som \u00E5terst\u00E4lls \u00E4r inte samma som de som st\u00E4llts in
cachedrowsetimpl.unsetmatch1 = Anv\u00E4nd kolumnnamn som argument f\u00F6r unsetMatchColumn
cachedrowsetimpl.unsetmatch2 = Anv\u00E4nd kolumn-id som argument f\u00F6r unsetMatchColumn
cachedrowsetimpl.numrows = Antalet rader understiger noll eller \u00E4r mindre \u00E4n h\u00E4mtningsstorleken
cachedrowsetimpl.startpos = Startpositionen f\u00E5r inte vara negativ
cachedrowsetimpl.nextpage = Fyll i data innan anrop
cachedrowsetimpl.pagesize = Sidstorleken f\u00E5r inte understiga noll
cachedrowsetimpl.pagesize1 = Sidstorleken f\u00E5r inte \u00F6verstiga maxRows
cachedrowsetimpl.fwdonly = ResultSet kan endast g\u00E5 fram\u00E5t
cachedrowsetimpl.type = Typ: {0}
cachedrowsetimpl.opnotysupp = Det finns \u00E4nnu inget st\u00F6d f\u00F6r denna \u00E5tg\u00E4rd
cachedrowsetimpl.featnotsupp = Funktionen st\u00F6ds inte
# WebRowSetImpl exceptions
webrowsetimpl.nullhash = Kan inte instansiera WebRowSetImpl. Null-hashtabell skickades till konstruktor.
webrowsetimpl.invalidwr = Ogiltig skrivfunktion
webrowsetimpl.invalidrd = Ogiltig l\u00E4sare
#FilteredRowSetImpl exceptions
filteredrowsetimpl.relative = relative: Ogiltig mark\u00F6r\u00E5tg\u00E4rd
filteredrowsetimpl.absolute = absolute: Ogiltig mark\u00F6r\u00E5tg\u00E4rd
filteredrowsetimpl.notallowed = Detta v\u00E4rde kommer att filtreras bort
#JoinRowSetImpl exceptions
joinrowsetimpl.notinstance = Detta \u00E4r inte en instans av radupps\u00E4ttning
joinrowsetimpl.matchnotset = Matchningskolumnen \u00E4r inte inst\u00E4lld p\u00E5 koppling
joinrowsetimpl.numnotequal = Antal objekt i radupps\u00E4ttning st\u00E4mmer inte med matchningskolumnens
joinrowsetimpl.notdefined = Detta \u00E4r inte n\u00E5gon definierad kopplingstyp
joinrowsetimpl.notsupported = Det finns inget st\u00F6d f\u00F6r denna kopplingstyp
joinrowsetimpl.initerror = Initieringsfel f\u00F6r JoinRowSet
joinrowsetimpl.genericerr = Allm\u00E4nt initieringsfel f\u00F6r JoinRowSet
joinrowsetimpl.emptyrowset = Tomma radupps\u00E4ttningar kan inte l\u00E4ggas till i denna JoinRowSet
#JdbcRowSetImpl exceptions
jdbcrowsetimpl.invalstate = Ogiltigt tillst\u00E5nd
jdbcrowsetimpl.connect = JdbcRowSet (anslut) JNDI kan inte anslutas
jdbcrowsetimpl.paramtype = Kan inte h\u00E4rleda parametertypen
jdbcrowsetimpl.matchcols = Matchningskolumnerna \u00E4r inte samma som de som st\u00E4llts in
jdbcrowsetimpl.setmatchcols = St\u00E4ll in matchningskolumnerna innan du h\u00E4mtar dem
jdbcrowsetimpl.matchcols1 = Matchningskolumnerna m\u00E5ste vara st\u00F6rre \u00E4n 0
jdbcrowsetimpl.matchcols2 = Matchningskolumnerna kan inte vara en null-str\u00E4ng eller tomma
jdbcrowsetimpl.unsetmatch = Kolumnerna som \u00E5terst\u00E4lls \u00E4r inte samma som de som st\u00E4llts in
jdbcrowsetimpl.usecolname = Anv\u00E4nd kolumnnamn som argument f\u00F6r unsetMatchColumn
jdbcrowsetimpl.usecolid = Anv\u00E4nd kolumn-id som argument f\u00F6r unsetMatchColumn
jdbcrowsetimpl.resnotupd = ResultSet \u00E4r inte uppdateringsbart
jdbcrowsetimpl.opnotysupp = Det finns \u00E4nnu inget st\u00F6d f\u00F6r denna \u00E5tg\u00E4rd
jdbcrowsetimpl.featnotsupp = Funktionen st\u00F6ds inte
#CachedRowSetReader exceptions
crsreader.connect = (JNDI) kan inte anslutas
crsreader.paramtype = Kan inte h\u00E4rleda parametertypen
crsreader.connecterr = Internt fel i RowSetReader: ingen anslutning eller inget kommando
crsreader.datedetected = Ett datum har identifierats
crsreader.caldetected = En kalender har identifierats
#CachedRowSetWriter exceptions
crswriter.connect = Kan inte uppr\u00E4tta n\u00E5gon anslutning
crswriter.tname = writeData kan inte fastst\u00E4lla tabellnamnet
crswriter.params1 = Parameterv\u00E4rde1: {0}
crswriter.params2 = Parameterv\u00E4rde2: {0}
crswriter.conflictsno = orsakar konflikt vid synkronisering
#InsertRow exceptions
insertrow.novalue = Inget v\u00E4rde har infogats
#SyncResolverImpl exceptions
syncrsimpl.indexval = Indexv\u00E4rdet ligger utanf\u00F6r intervallet
syncrsimpl.noconflict = Kolumnen orsakar ingen konflikt
syncrsimpl.syncnotpos = Synkronisering \u00E4r inte m\u00F6jlig
syncrsimpl.valtores = V\u00E4rdet som ska fastst\u00E4llas kan antingen finnas i databasen eller i cachedrowset
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = Slutet p\u00E5 RowSet har n\u00E5tts. Mark\u00F6rpositionen \u00E4r ogiltig.
wrsxmlreader.readxml = readXML: {0}
wrsxmlreader.parseerr = ** Tolkningsfel: {0}, rad: {1}, URI: {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException: {0}
wrsxmlwriter.sqlex = SQLException: {0}
wrsxmlwriter.failedwrite = Kunde inte skriva v\u00E4rdet
wsrxmlwriter.notproper = Ingen riktig typ
#XmlReaderContentHandler exceptions
xmlrch.errmap = Ett fel intr\u00E4ffade vid inst\u00E4llning av mappning: {0}
xmlrch.errmetadata = Ett fel intr\u00E4ffade vid inst\u00E4llning av metadata: {0}
xmlrch.errinsertval = Ett fel intr\u00E4ffade vid infogning av v\u00E4rden: {0}
xmlrch.errconstr = Ett fel intr\u00E4ffade vid konstruktion av rad: {0}
xmlrch.errdel = Ett fel intr\u00E4ffade vid borttagning av rad: {0}
xmlrch.errinsert = Ett fel intr\u00E4ffade vid konstruktion av infogad rad: {0}
xmlrch.errinsdel = Ett fel intr\u00E4ffade vid konstruktion av insdel-rad: {0}
xmlrch.errupdate = Ett fel intr\u00E4ffade vid konstruktion av uppdateringsrad: {0}
xmlrch.errupdrow = Ett fel intr\u00E4ffade vid uppdatering av rad: {0}
xmlrch.chars = tecken:
xmlrch.badvalue = Felaktigt v\u00E4rde; egenskapen kan inte ha ett tomt v\u00E4rde
xmlrch.badvalue1 = Felaktigt v\u00E4rde; metadatan kan inte ha ett tomt v\u00E4rde
xmlrch.warning = ** Varning! {0}, rad: {1}, URI: {2}
#RIOptimisticProvider Exceptions
riop.locking = Det finns inte st\u00F6d f\u00F6r denna l\u00E5sningsklassificering
#RIXMLProvider exceptions
rixml.unsupp = RIXMLProvider har inte st\u00F6d f\u00F6r detta

View file

@ -0,0 +1,170 @@
#
# Copyright (c) 2005, 2013, 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.
#
# CacheRowSetImpl exceptions
cachedrowsetimpl.populate = \u63D0\u4F9B\u7ED9\u586B\u5145\u65B9\u6CD5\u7684 ResultSet \u5BF9\u8C61\u65E0\u6548
cachedrowsetimpl.invalidp = \u751F\u6210\u7684\u6301\u4E45\u6027\u63D0\u4F9B\u65B9\u65E0\u6548
cachedrowsetimpl.nullhash = \u65E0\u6CD5\u5B9E\u4F8B\u5316 CachedRowSetImpl \u5B9E\u4F8B\u3002\u63D0\u4F9B\u7ED9\u6784\u9020\u5668\u7684 Hashtable \u4E3A\u7A7A\u503C
cachedrowsetimpl.invalidop = \u5BF9\u63D2\u5165\u884C\u6267\u884C\u7684\u64CD\u4F5C\u65E0\u6548
cachedrowsetimpl.accfailed = acceptChanges \u5931\u8D25
cachedrowsetimpl.invalidcp = \u5149\u6807\u4F4D\u7F6E\u65E0\u6548
cachedrowsetimpl.illegalop = \u5BF9\u975E\u63D2\u5165\u884C\u6267\u884C\u7684\u64CD\u4F5C\u975E\u6CD5
cachedrowsetimpl.clonefail = \u514B\u9686\u5931\u8D25: {0}
cachedrowsetimpl.invalidcol = \u5217\u7D22\u5F15\u65E0\u6548
cachedrowsetimpl.invalcolnm = \u5217\u540D\u65E0\u6548
cachedrowsetimpl.boolfail = \u5BF9\u5217 {1} \u4E2D\u7684\u503C ({0}) \u6267\u884C getBoolen \u5931\u8D25
cachedrowsetimpl.bytefail = \u5BF9\u5217 {1} \u4E2D\u7684\u503C ({0}) \u6267\u884C getByte \u5931\u8D25
cachedrowsetimpl.shortfail = \u5BF9\u5217 {1} \u4E2D\u7684\u503C ({0}) \u6267\u884C getShort \u5931\u8D25
cachedrowsetimpl.intfail = \u5BF9\u5217 {1} \u4E2D\u7684\u503C ({0}) \u6267\u884C getInt \u5931\u8D25
cachedrowsetimpl.longfail = \u5BF9\u5217 {1} \u4E2D\u7684\u503C ({0}) \u6267\u884C getLong \u5931\u8D25
cachedrowsetimpl.floatfail = \u5BF9\u5217 {1} \u4E2D\u7684\u503C ({0}) \u6267\u884C getFloat \u5931\u8D25
cachedrowsetimpl.doublefail = \u5BF9\u5217 {1} \u4E2D\u7684\u503C ({0}) \u6267\u884C getDouble \u5931\u8D25
cachedrowsetimpl.dtypemismt = \u6570\u636E\u7C7B\u578B\u4E0D\u5339\u914D
cachedrowsetimpl.datefail = \u5BF9\u5217 {1} \u4E2D\u7684\u503C ({0}) \u6267\u884C getDate \u5931\u8D25, \u65E0\u53EF\u7528\u8F6C\u6362
cachedrowsetimpl.timefail = \u5BF9\u5217 {1} \u4E2D\u7684\u503C ({0}) \u6267\u884C getTime \u5931\u8D25, \u65E0\u53EF\u7528\u8F6C\u6362
cachedrowsetimpl.posupdate = \u4E0D\u652F\u6301\u5B9A\u4F4D\u66F4\u65B0
cachedrowsetimpl.unableins = \u65E0\u6CD5\u5B9E\u4F8B\u5316: {0}
cachedrowsetimpl.beforefirst = beforeFirst: \u5149\u6807\u64CD\u4F5C\u65E0\u6548
cachedrowsetimpl.first = First: \u5149\u6807\u64CD\u4F5C\u65E0\u6548
cachedrowsetimpl.last = last: TYPE_FORWARD_ONLY
cachedrowsetimpl.absolute = absolute: \u5149\u6807\u4F4D\u7F6E\u65E0\u6548
cachedrowsetimpl.relative = relative: \u5149\u6807\u4F4D\u7F6E\u65E0\u6548
cachedrowsetimpl.asciistream = \u672A\u80FD\u8BFB\u53D6 ASCII \u6D41
cachedrowsetimpl.binstream = \u672A\u80FD\u8BFB\u53D6\u4E8C\u8FDB\u5236\u6D41
cachedrowsetimpl.failedins = \u5BF9\u63D2\u5165\u884C\u6267\u884C\u64CD\u4F5C\u5931\u8D25
cachedrowsetimpl.updateins = \u4E3A\u63D2\u5165\u884C\u8C03\u7528 updateRow
cachedrowsetimpl.movetoins = moveToInsertRow: CONCUR_READ_ONLY
cachedrowsetimpl.movetoins1 = moveToInsertRow: \u65E0\u5143\u6570\u636E
cachedrowsetimpl.movetoins2 = moveToInsertRow: \u5217\u6570\u65E0\u6548
cachedrowsetimpl.tablename = \u8868\u540D\u4E0D\u80FD\u4E3A\u7A7A\u503C
cachedrowsetimpl.keycols = \u5173\u952E\u5B57\u5217\u65E0\u6548
cachedrowsetimpl.invalidcol = \u5217\u7D22\u5F15\u65E0\u6548
cachedrowsetimpl.opnotsupp = \u64CD\u4F5C\u4E0D\u53D7\u6570\u636E\u5E93\u652F\u6301
cachedrowsetimpl.matchcols = \u5339\u914D\u5217\u4E0E\u8BBE\u7F6E\u7684\u90A3\u4E9B\u5339\u914D\u5217\u4E0D\u540C
cachedrowsetimpl.setmatchcols = \u5728\u83B7\u53D6\u5339\u914D\u5217\u4E4B\u524D\u5148\u8BBE\u7F6E\u5339\u914D\u5217
cachedrowsetimpl.matchcols1 = \u5339\u914D\u5217\u6570\u5E94\u5F53\u5927\u4E8E 0
cachedrowsetimpl.matchcols2 = \u5339\u914D\u5217\u6570\u5E94\u5F53\u4E3A\u7A7A\u6216\u7A7A\u503C\u5B57\u7B26\u4E32
cachedrowsetimpl.unsetmatch = \u8981\u53D6\u6D88\u8BBE\u7F6E\u7684\u5217\u4E0E\u8BBE\u7F6E\u7684\u5217\u4E0D\u540C
cachedrowsetimpl.unsetmatch1 = \u4F7F\u7528\u5217\u540D\u4F5C\u4E3A unsetMatchColumn \u7684\u53C2\u6570
cachedrowsetimpl.unsetmatch2 = \u4F7F\u7528\u5217 ID \u4F5C\u4E3A unsetMatchColumn \u7684\u53C2\u6570
cachedrowsetimpl.numrows = \u884C\u6570\u5C0F\u4E8E\u96F6\u6216\u5C0F\u4E8E\u8981\u63D0\u53D6\u7684\u884C\u6570
cachedrowsetimpl.startpos = \u8D77\u59CB\u4F4D\u7F6E\u4E0D\u80FD\u4E3A\u8D1F\u6570
cachedrowsetimpl.nextpage = \u5728\u8C03\u7528\u4E4B\u524D\u5148\u586B\u5145\u6570\u636E
cachedrowsetimpl.pagesize = \u9875\u9762\u5927\u5C0F\u4E0D\u80FD\u5C0F\u4E8E\u96F6
cachedrowsetimpl.pagesize1 = \u9875\u9762\u5927\u5C0F\u4E0D\u80FD\u5927\u4E8E maxRows
cachedrowsetimpl.fwdonly = ResultSet \u7684\u7C7B\u578B\u4E3A\u4EC5\u5411\u524D\u7C7B\u578B
cachedrowsetimpl.type = \u7C7B\u578B\u4E3A: {0}
cachedrowsetimpl.opnotysupp = \u5C1A\u4E0D\u652F\u6301\u8BE5\u64CD\u4F5C
cachedrowsetimpl.featnotsupp = \u5C1A\u4E0D\u652F\u6301\u8BE5\u529F\u80FD
# WebRowSetImpl exceptions
webrowsetimpl.nullhash = \u65E0\u6CD5\u5B9E\u4F8B\u5316 WebRowSetImpl \u5B9E\u4F8B\u3002\u63D0\u4F9B\u7ED9\u6784\u9020\u5668\u7684 Hashtable \u4E3A\u7A7A\u503C
webrowsetimpl.invalidwr = \u5199\u8FDB\u7A0B\u65E0\u6548
webrowsetimpl.invalidrd = \u8BFB\u8FDB\u7A0B\u65E0\u6548
#FilteredRowSetImpl exceptions
filteredrowsetimpl.relative = relative: \u5149\u6807\u64CD\u4F5C\u65E0\u6548
filteredrowsetimpl.absolute = absolute: \u5149\u6807\u64CD\u4F5C\u65E0\u6548
filteredrowsetimpl.notallowed = \u4E0D\u5141\u8BB8\u6B64\u503C\u901A\u8FC7\u7B5B\u9009\u5668
#JoinRowSetImpl exceptions
joinrowsetimpl.notinstance = \u4E0D\u662F RowSet \u7684\u5B9E\u4F8B
joinrowsetimpl.matchnotset = \u672A\u8BBE\u7F6E\u5339\u914D\u5217\u4EE5\u8FDB\u884C\u8054\u63A5
joinrowsetimpl.numnotequal = RowSet \u4E2D\u7684\u5143\u7D20\u4E2A\u6570\u4E0D\u7B49\u4E8E\u5339\u914D\u5217\u6570
joinrowsetimpl.notdefined = \u8FD9\u4E0D\u662F\u5B9A\u4E49\u7684\u8054\u63A5\u7C7B\u578B
joinrowsetimpl.notsupported = \u4E0D\u652F\u6301\u6B64\u8054\u63A5\u7C7B\u578B
joinrowsetimpl.initerror = JoinRowSet \u521D\u59CB\u5316\u9519\u8BEF
joinrowsetimpl.genericerr = \u4E00\u822C JoinRowSet \u521D\u59CB\u5316\u9519\u8BEF
joinrowsetimpl.emptyrowset = \u65E0\u6CD5\u5C06\u7A7A RowSet \u6DFB\u52A0\u5230\u6B64 JoinRowSet
#JdbcRowSetImpl exceptions
jdbcrowsetimpl.invalstate = \u72B6\u6001\u65E0\u6548
jdbcrowsetimpl.connect = JdbcRowSet (\u8FDE\u63A5) JNDI \u65E0\u6CD5\u8FDE\u63A5
jdbcrowsetimpl.paramtype = \u65E0\u6CD5\u63A8\u65AD\u53C2\u6570\u7C7B\u578B
jdbcrowsetimpl.matchcols = \u5339\u914D\u5217\u4E0E\u8BBE\u7F6E\u7684\u90A3\u4E9B\u5339\u914D\u5217\u4E0D\u540C
jdbcrowsetimpl.setmatchcols = \u5728\u83B7\u53D6\u5339\u914D\u5217\u4E4B\u524D\u5148\u8BBE\u7F6E\u5339\u914D\u5217
jdbcrowsetimpl.matchcols1 = \u5339\u914D\u5217\u6570\u5E94\u5F53\u5927\u4E8E 0
jdbcrowsetimpl.matchcols2 = \u5339\u914D\u5217\u4E0D\u80FD\u4E3A\u7A7A\u503C\u6216\u7A7A\u5B57\u7B26\u4E32
jdbcrowsetimpl.unsetmatch = \u8981\u53D6\u6D88\u8BBE\u7F6E\u7684\u5217\u4E0E\u8BBE\u7F6E\u7684\u5217\u4E0D\u540C
jdbcrowsetimpl.usecolname = \u4F7F\u7528\u5217\u540D\u4F5C\u4E3A unsetMatchColumn \u7684\u53C2\u6570
jdbcrowsetimpl.usecolid = \u4F7F\u7528\u5217 ID \u4F5C\u4E3A unsetMatchColumn \u7684\u53C2\u6570
jdbcrowsetimpl.resnotupd = ResultSet \u4E0D\u53EF\u66F4\u65B0
jdbcrowsetimpl.opnotysupp = \u5C1A\u4E0D\u652F\u6301\u8BE5\u64CD\u4F5C
jdbcrowsetimpl.featnotsupp = \u5C1A\u4E0D\u652F\u6301\u8BE5\u529F\u80FD
#CachedRowSetReader exceptions
crsreader.connect = (JNDI) \u65E0\u6CD5\u8FDE\u63A5
crsreader.paramtype = \u65E0\u6CD5\u63A8\u65AD\u53C2\u6570\u7C7B\u578B
crsreader.connecterr = RowSetReader \u4E2D\u51FA\u73B0\u5185\u90E8\u9519\u8BEF: \u65E0\u8FDE\u63A5\u6216\u547D\u4EE4
crsreader.datedetected = \u68C0\u6D4B\u5230\u65E5\u671F
crsreader.caldetected = \u68C0\u6D4B\u5230\u65E5\u5386
#CachedRowSetWriter exceptions
crswriter.connect = \u65E0\u6CD5\u83B7\u53D6\u8FDE\u63A5
crswriter.tname = writeData \u65E0\u6CD5\u786E\u5B9A\u8868\u540D
crswriter.params1 = params1 \u7684\u503C: {0}
crswriter.params2 = params2 \u7684\u503C: {0}
crswriter.conflictsno = \u540C\u6B65\u65F6\u53D1\u751F\u51B2\u7A81
#InsertRow exceptions
insertrow.novalue = \u5C1A\u672A\u63D2\u5165\u4EFB\u4F55\u503C
#SyncResolverImpl exceptions
syncrsimpl.indexval = \u7D22\u5F15\u503C\u8D85\u51FA\u8303\u56F4
syncrsimpl.noconflict = \u6B64\u5217\u4E0D\u51B2\u7A81
syncrsimpl.syncnotpos = \u4E0D\u80FD\u540C\u6B65
syncrsimpl.valtores = \u8981\u89E3\u6790\u7684\u503C\u53EF\u4EE5\u5728\u6570\u636E\u5E93\u4E2D, \u4E5F\u53EF\u4EE5\u5728 CachedRowSet \u4E2D
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = \u5DF2\u5230\u8FBE RowSet \u7684\u7ED3\u5C3E\u3002\u5149\u6807\u4F4D\u7F6E\u65E0\u6548
wrsxmlreader.readxml = readXML: {0}
wrsxmlreader.parseerr = ** \u89E3\u6790\u9519\u8BEF: {0}, \u884C: {1}, URI: {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException: {0}
wrsxmlwriter.sqlex = SQLException: {0}
wrsxmlwriter.failedwrite = \u65E0\u6CD5\u5199\u5165\u503C
wsrxmlwriter.notproper = \u7C7B\u578B\u4E0D\u6B63\u786E
#XmlReaderContentHandler exceptions
xmlrch.errmap = \u8BBE\u7F6E\u6620\u5C04\u65F6\u51FA\u9519: {0}
xmlrch.errmetadata = \u8BBE\u7F6E\u5143\u6570\u636E\u65F6\u51FA\u9519: {0}
xmlrch.errinsertval = \u63D2\u5165\u503C\u65F6\u51FA\u9519: {0}
xmlrch.errconstr = \u6784\u9020\u884C\u65F6\u51FA\u9519: {0}
xmlrch.errdel = \u5220\u9664\u884C\u65F6\u51FA\u9519: {0}
xmlrch.errinsert = \u6784\u9020\u63D2\u5165\u884C\u65F6\u51FA\u9519: {0}
xmlrch.errinsdel = \u6784\u9020 insdel \u884C\u65F6\u51FA\u9519: {0}
xmlrch.errupdate = \u6784\u9020\u66F4\u65B0\u884C\u65F6\u51FA\u9519: {0}
xmlrch.errupdrow = \u66F4\u65B0\u884C\u65F6\u51FA\u9519: {0}
xmlrch.chars = \u5B57\u7B26:
xmlrch.badvalue = \u503C\u9519\u8BEF; \u5C5E\u6027\u4E0D\u53EF\u4E3A\u7A7A\u503C
xmlrch.badvalue1 = \u503C\u9519\u8BEF; \u5143\u6570\u636E\u4E0D\u53EF\u4E3A\u7A7A\u503C
xmlrch.warning = ** \u8B66\u544A: {0}, \u884C: {1}, URI: {2}
#RIOptimisticProvider Exceptions
riop.locking = \u4E0D\u652F\u6301\u9501\u5B9A\u5206\u7C7B
#RIXMLProvider exceptions
rixml.unsupp = \u4E0D\u652F\u6301 RIXMLProvider

View file

@ -0,0 +1,170 @@
#
# Copyright (c) 2005, 2013, 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.
#
# CacheRowSetImpl exceptions
cachedrowsetimpl.populate = \u70BA\u690D\u5165\u65B9\u6CD5\u63D0\u4F9B\u7684 ResultSet \u7269\u4EF6\u7121\u6548
cachedrowsetimpl.invalidp = \u7522\u751F\u7684\u6301\u7E8C\u6027\u63D0\u4F9B\u8005\u7121\u6548
cachedrowsetimpl.nullhash = \u7121\u6CD5\u5EFA\u7ACB CachedRowSetImpl \u57F7\u884C\u8655\u7406\u3002\u70BA\u5EFA\u69CB\u5B50\u63D0\u4F9B\u7684 Hashtable \u70BA\u7A7A\u503C
cachedrowsetimpl.invalidop = \u63D2\u5165\u5217\u6642\u7684\u4F5C\u696D\u7121\u6548
cachedrowsetimpl.accfailed = acceptChanges \u5931\u6557
cachedrowsetimpl.invalidcp = \u6E38\u6A19\u4F4D\u7F6E\u7121\u6548
cachedrowsetimpl.illegalop = \u975E\u63D2\u5165\u5217\u4E0A\u5B58\u5728\u7121\u6548\u4F5C\u696D
cachedrowsetimpl.clonefail = \u8907\u88FD\u5931\u6557: {0}
cachedrowsetimpl.invalidcol = \u6B04\u7D22\u5F15\u7121\u6548
cachedrowsetimpl.invalcolnm = \u6B04\u540D\u7121\u6548
cachedrowsetimpl.boolfail = \u5C0D\u6B04 {1} \u4E2D\u7684\u503C ( {0} ) \u57F7\u884C getBoolen \u5931\u6557
cachedrowsetimpl.bytefail = \u5C0D\u6B04 {1} \u4E2D\u7684\u503C ( {0} ) \u57F7\u884C getByte \u5931\u6557
cachedrowsetimpl.shortfail = \u5C0D\u6B04 {1} \u4E2D\u7684\u503C ( {0} ) \u57F7\u884C getShort \u5931\u6557
cachedrowsetimpl.intfail = \u5C0D\u6B04 {1} \u4E2D\u7684\u503C ( {0} ) \u57F7\u884C getInt \u5931\u6557
cachedrowsetimpl.longfail = \u5C0D\u6B04 {1} \u4E2D\u7684\u503C ( {0} ) \u57F7\u884C getLong \u5931\u6557
cachedrowsetimpl.floatfail = \u5C0D\u6B04 {1} \u4E2D\u7684\u503C ( {0} ) \u57F7\u884C getFloat \u5931\u6557
cachedrowsetimpl.doublefail = \u5C0D\u6B04 {1} \u4E2D\u7684\u503C ( {0} ) \u57F7\u884C getDouble \u5931\u6557
cachedrowsetimpl.dtypemismt = \u8CC7\u6599\u985E\u578B\u4E0D\u76F8\u7B26
cachedrowsetimpl.datefail = \u5C0D\u6B04 {1} \u4E2D\u7684\u503C ( {0} ) \u57F7\u884C getDate \u5931\u6557\uFF0C\u672A\u9032\u884C\u8F49\u63DB
cachedrowsetimpl.timefail = \u5C0D\u6B04 {1} \u4E2D\u7684\u503C ( {0} ) \u57F7\u884C getTime \u5931\u6557\uFF0C\u672A\u9032\u884C\u8F49\u63DB
cachedrowsetimpl.posupdate = \u4E0D\u652F\u63F4\u5B9A\u4F4D\u7684\u66F4\u65B0
cachedrowsetimpl.unableins = \u7121\u6CD5\u5EFA\u7ACB: {0}
cachedrowsetimpl.beforefirst = beforeFirst: \u6E38\u6A19\u4F5C\u696D\u7121\u6548
cachedrowsetimpl.first = First: \u6E38\u6A19\u4F5C\u696D\u7121\u6548
cachedrowsetimpl.last = last : TYPE_FORWARD_ONLY
cachedrowsetimpl.absolute = absolute: \u6E38\u6A19\u4F4D\u7F6E\u7121\u6548
cachedrowsetimpl.relative = relative: \u6E38\u6A19\u4F4D\u7F6E\u7121\u6548
cachedrowsetimpl.asciistream = \u8B80\u53D6 ascii \u4E32\u6D41\u5931\u6557
cachedrowsetimpl.binstream = \u8B80\u53D6\u4E8C\u9032\u4F4D\u4E32\u6D41\u5931\u6557
cachedrowsetimpl.failedins = \u63D2\u5165\u5217\u5931\u6557
cachedrowsetimpl.updateins = \u63D2\u5165\u5217\u6642\u547C\u53EB updateRow
cachedrowsetimpl.movetoins = moveToInsertRow: CONCUR_READ_ONLY
cachedrowsetimpl.movetoins1 = moveToInsertRow: \u6C92\u6709\u63CF\u8FF0\u8CC7\u6599
cachedrowsetimpl.movetoins2 = moveToInsertRow: \u6B04\u6578\u7121\u6548
cachedrowsetimpl.tablename = \u8868\u683C\u540D\u7A31\u4E0D\u80FD\u70BA\u7A7A\u503C
cachedrowsetimpl.keycols = \u95DC\u9375\u6B04\u7121\u6548
cachedrowsetimpl.invalidcol = \u6B04\u7D22\u5F15\u7121\u6548
cachedrowsetimpl.opnotsupp = \u8CC7\u6599\u5EAB\u4E0D\u652F\u63F4\u4F5C\u696D
cachedrowsetimpl.matchcols = \u5339\u914D\u6B04\u548C\u8A2D\u5B9A\u7684\u6B04\u4E0D\u540C
cachedrowsetimpl.setmatchcols = \u5728\u53D6\u5F97\u5339\u914D\u6B04\u4E4B\u524D\u8A2D\u5B9A\u5B83\u5011
cachedrowsetimpl.matchcols1 = \u5339\u914D\u6B04\u61C9\u5927\u65BC 0
cachedrowsetimpl.matchcols2 = \u5339\u914D\u6B04\u61C9\u70BA\u7A7A\u767D\u5B57\u4E32\u6216\u7A7A\u503C\u5B57\u4E32
cachedrowsetimpl.unsetmatch = \u53D6\u6D88\u8A2D\u5B9A\u7684\u6B04\u548C\u8A2D\u5B9A\u7684\u6B04\u4E0D\u540C
cachedrowsetimpl.unsetmatch1 = \u4F7F\u7528\u6B04\u540D\u4F5C\u70BA unsetMatchColumn \u7684\u5F15\u6578
cachedrowsetimpl.unsetmatch2 = \u4F7F\u7528\u6B04 ID \u4F5C\u70BA unsetMatchColumn \u7684\u5F15\u6578
cachedrowsetimpl.numrows = \u5217\u6578\u5C0F\u65BC\u96F6\u6216\u5C0F\u65BC\u64F7\u53D6\u5927\u5C0F
cachedrowsetimpl.startpos = \u8D77\u59CB\u4F4D\u7F6E\u4E0D\u80FD\u70BA\u8CA0\u6578
cachedrowsetimpl.nextpage = \u5728\u547C\u53EB\u4E4B\u524D\u690D\u5165\u8CC7\u6599
cachedrowsetimpl.pagesize = \u9801\u9762\u5927\u5C0F\u4E0D\u80FD\u5C0F\u65BC\u96F6
cachedrowsetimpl.pagesize1 = \u9801\u9762\u5927\u5C0F\u4E0D\u80FD\u5927\u65BC maxRows
cachedrowsetimpl.fwdonly = ResultSet \u53EA\u80FD\u5411\u524D\u9032\u884C
cachedrowsetimpl.type = \u985E\u578B\u662F: {0}
cachedrowsetimpl.opnotysupp = \u5C1A\u4E0D\u652F\u63F4\u8A72\u4F5C\u696D
cachedrowsetimpl.featnotsupp = \u4E0D\u652F\u63F4\u8A72\u529F\u80FD
# WebRowSetImpl exceptions
webrowsetimpl.nullhash = \u7121\u6CD5\u5EFA\u7ACB WebRowSetImpl \u57F7\u884C\u8655\u7406\u3002\u70BA\u5EFA\u69CB\u5B50\u63D0\u4F9B\u7684 Hashtable \u70BA\u7A7A\u503C
webrowsetimpl.invalidwr = \u5BEB\u5165\u5668\u7121\u6548
webrowsetimpl.invalidrd = \u8B80\u53D6\u5668\u7121\u6548
#FilteredRowSetImpl exceptions
filteredrowsetimpl.relative = relative: \u6E38\u6A19\u4F5C\u696D\u7121\u6548
filteredrowsetimpl.absolute = absolute: \u6E38\u6A19\u4F5C\u696D\u7121\u6548
filteredrowsetimpl.notallowed = \u4E0D\u5141\u8A31\u6B64\u503C\u901A\u904E\u7BE9\u9078
#JoinRowSetImpl exceptions
joinrowsetimpl.notinstance = \u4E0D\u662F rowset \u7684\u57F7\u884C\u8655\u7406
joinrowsetimpl.matchnotset = \u672A\u8A2D\u5B9A\u7528\u65BC\u9023\u7D50\u7684\u5339\u914D\u6B04
joinrowsetimpl.numnotequal = rowset \u4E2D\u7684\u5143\u7D20\u6578\u4E0D\u7B49\u65BC\u5339\u914D\u6B04
joinrowsetimpl.notdefined = \u9019\u4E0D\u662F\u9023\u7D50\u7684\u5DF2\u5B9A\u7FA9\u985E\u578B
joinrowsetimpl.notsupported = \u4E0D\u652F\u63F4\u6B64\u985E\u9023\u7D50
joinrowsetimpl.initerror = JoinRowSet \u521D\u59CB\u5316\u932F\u8AA4
joinrowsetimpl.genericerr = \u4E00\u822C\u7684 joinrowset \u521D\u59CB\u5316\u932F\u8AA4
joinrowsetimpl.emptyrowset = \u7121\u6CD5\u5C07\u7A7A rowset \u65B0\u589E\u81F3\u6B64 JoinRowSet
#JdbcRowSetImpl exceptions
jdbcrowsetimpl.invalstate = \u72C0\u614B\u7121\u6548
jdbcrowsetimpl.connect = JdbcRowSet (\u9023\u7DDA) JNDI \u7121\u6CD5\u9023\u7DDA
jdbcrowsetimpl.paramtype = \u7121\u6CD5\u63A8\u65B7\u53C3\u6578\u985E\u578B
jdbcrowsetimpl.matchcols = \u5339\u914D\u6B04\u548C\u8A2D\u5B9A\u7684\u6B04\u4E0D\u540C
jdbcrowsetimpl.setmatchcols = \u8981\u5148\u8A2D\u5B9A\u5339\u914D\u6B04\uFF0C\u624D\u80FD\u53D6\u5F97\u5B83\u5011
jdbcrowsetimpl.matchcols1 = \u5339\u914D\u6B04\u61C9\u5927\u65BC 0
jdbcrowsetimpl.matchcols2 = \u5339\u914D\u6B04\u4E0D\u80FD\u70BA\u7A7A\u767D\u5B57\u4E32\u6216\u7A7A\u503C\u5B57\u4E32
jdbcrowsetimpl.unsetmatch = \u53D6\u6D88\u8A2D\u5B9A\u7684\u6B04\u548C\u8A2D\u5B9A\u7684\u6B04\u4E0D\u540C
jdbcrowsetimpl.usecolname = \u4F7F\u7528\u6B04\u540D\u4F5C\u70BA unsetMatchColumn \u7684\u5F15\u6578
jdbcrowsetimpl.usecolid = \u4F7F\u7528\u6B04 ID \u4F5C\u70BA unsetMatchColumn \u7684\u5F15\u6578
jdbcrowsetimpl.resnotupd = ResultSet \u4E0D\u53EF\u66F4\u65B0
jdbcrowsetimpl.opnotysupp = \u5C1A\u4E0D\u652F\u63F4\u8A72\u4F5C\u696D
jdbcrowsetimpl.featnotsupp = \u4E0D\u652F\u63F4\u8A72\u529F\u80FD
#CachedRowSetReader exceptions
crsreader.connect = (JNDI) \u7121\u6CD5\u9023\u7DDA
crsreader.paramtype = \u7121\u6CD5\u63A8\u65B7\u53C3\u6578\u985E\u578B
crsreader.connecterr = RowSetReader \u4E2D\u51FA\u73FE\u5167\u90E8\u932F\u8AA4: \u7121\u9023\u7DDA\u6216\u547D\u4EE4
crsreader.datedetected = \u5075\u6E2C\u5230\u65E5\u671F
crsreader.caldetected = \u5075\u6E2C\u5230\u884C\u4E8B\u66C6
#CachedRowSetWriter exceptions
crswriter.connect = \u7121\u6CD5\u53D6\u5F97\u9023\u7DDA
crswriter.tname = writeData \u4E0D\u80FD\u6C7A\u5B9A\u8868\u683C\u540D\u7A31
crswriter.params1 = params1 \u7684\u503C: {0}
crswriter.params2 = params2 \u7684\u503C: {0}
crswriter.conflictsno = \u540C\u6B65\u5316\u6642\u767C\u751F\u885D\u7A81
#InsertRow exceptions
insertrow.novalue = \u5C1A\u672A\u63D2\u5165\u503C
#SyncResolverImpl exceptions
syncrsimpl.indexval = \u7D22\u5F15\u503C\u8D85\u51FA\u7BC4\u570D
syncrsimpl.noconflict = \u6B64\u6B04\u4E0D\u885D\u7A81
syncrsimpl.syncnotpos = \u4E0D\u53EF\u80FD\u540C\u6B65\u5316
syncrsimpl.valtores = \u8981\u89E3\u6790\u7684\u503C\u53EF\u4F4D\u65BC\u8CC7\u6599\u5EAB\u6216 cachedrowset \u4E2D
#WebRowSetXmlReader exception
wrsxmlreader.invalidcp = \u5DF2\u5230\u9054 RowSet \u7D50\u5C3E\u3002\u6E38\u6A19\u4F4D\u7F6E\u7121\u6548
wrsxmlreader.readxml = readXML: {0}
wrsxmlreader.parseerr = ** \u5256\u6790\u932F\u8AA4: {0}\uFF0C\u884C: {1}\uFF0Curi: {2}
#WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException : {0}
wrsxmlwriter.sqlex = SQLException : {0}
wrsxmlwriter.failedwrite = \u5BEB\u5165\u503C\u5931\u6557
wsrxmlwriter.notproper = \u4E0D\u662F\u6B63\u78BA\u985E\u578B
#XmlReaderContentHandler exceptions
xmlrch.errmap = \u8A2D\u5B9A\u5C0D\u6620\u6642\u767C\u751F\u932F\u8AA4: {0}
xmlrch.errmetadata = \u8A2D\u5B9A\u63CF\u8FF0\u8CC7\u6599\u6642\u767C\u751F\u932F\u8AA4: {0}
xmlrch.errinsertval = \u63D2\u5165\u503C\u6642\u767C\u751F\u932F\u8AA4: {0}
xmlrch.errconstr = \u5EFA\u69CB\u5217\u6642\u767C\u751F\u932F\u8AA4: {0}
xmlrch.errdel = \u522A\u9664\u5217\u6642\u767C\u751F\u932F\u8AA4: {0}
xmlrch.errinsert = \u5EFA\u69CB\u63D2\u5165\u5217\u6642\u767C\u751F\u932F\u8AA4 : {0}
xmlrch.errinsdel = \u5EFA\u69CB insdel \u5217\u6642\u767C\u751F\u932F\u8AA4: {0}
xmlrch.errupdate = \u5EFA\u69CB\u66F4\u65B0\u5217\u6642\u767C\u751F\u932F\u8AA4: {0}
xmlrch.errupdrow = \u66F4\u65B0\u5217\u6642\u767C\u751F\u932F\u8AA4: {0}
xmlrch.chars = \u5B57\u5143:
xmlrch.badvalue = \u932F\u8AA4\u7684\u503C; \u5C6C\u6027\u4E0D\u80FD\u70BA\u7A7A\u503C
xmlrch.badvalue1 = \u932F\u8AA4\u7684\u503C; \u63CF\u8FF0\u8CC7\u6599\u4E0D\u80FD\u70BA\u7A7A\u503C
xmlrch.warning = ** \u8B66\u544A: {0}\uFF0C\u884C: {1}\uFF0Curi: {2}
#RIOptimisticProvider Exceptions
riop.locking = \u4E0D\u652F\u63F4\u9396\u5B9A\u5206\u985E
#RIXMLProvider exceptions
rixml.unsupp = RIXMLProvider \u4E0D\u652F\u63F4

View file

@ -0,0 +1,292 @@
/*
* Copyright (c) 2003, 2013, 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.*;
import javax.sql.*;
import java.io.*;
import java.math.*;
import java.util.*;
import java.text.*;
import org.xml.sax.*;
import javax.sql.rowset.*;
import javax.sql.rowset.spi.*;
import com.sun.rowset.providers.*;
import com.sun.rowset.internal.*;
/**
* The standard implementation of the <code>WebRowSet</code> interface. See the interface
* definition for full behavior and implementation requirements.
*
* @author Jonathan Bruce, Amit Handa
*/
public class WebRowSetImpl extends CachedRowSetImpl implements WebRowSet {
/**
* The <code>WebRowSetXmlReader</code> object that this
* <code>WebRowSet</code> object will call when the method
* <code>WebRowSet.readXml</code> is invoked.
*/
private WebRowSetXmlReader xmlReader;
/**
* The <code>WebRowSetXmlWriter</code> object that this
* <code>WebRowSet</code> object will call when the method
* <code>WebRowSet.writeXml</code> is invoked.
*/
private WebRowSetXmlWriter xmlWriter;
/* This stores the cursor position prior to calling the writeXML.
* This variable is used after the write to restore the position
* to the point where the writeXml was called.
*/
private int curPosBfrWrite;
private SyncProvider provider;
/**
* Constructs a new <code>WebRowSet</code> object initialized with the
* default values for a <code>CachedRowSet</code> object instance. This
* provides the <code>RIOptimistic</code> provider to deliver
* synchronization capabilities to relational datastores and a default
* <code>WebRowSetXmlReader</code> object and a default
* <code>WebRowSetXmlWriter</code> object to enable XML output
* capabilities.
*
* @throws SQLException if an error occurs in configuring the default
* synchronization providers for relational and XML providers.
*/
public WebRowSetImpl() throws SQLException {
super();
// %%%
// Needs to use to SPI XmlReader,XmlWriters
//
xmlReader = new WebRowSetXmlReader();
xmlWriter = new WebRowSetXmlWriter();
}
/**
* Constructs a new <code>WebRowSet</code> object initialized with the
* synchronization SPI provider properties as specified in the <code>Hashtable</code>. If
* this hashtable is empty or is <code>null</code> the default constructor is invoked.
*
* @throws SQLException if an error occurs in configuring the specified
* synchronization providers for the relational and XML providers; or
* if the Hashtanle is null
*/
@SuppressWarnings("rawtypes")
public WebRowSetImpl(Hashtable env) throws SQLException {
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
if ( env == null) {
throw new SQLException(resBundle.handleGetObject("webrowsetimpl.nullhash").toString());
}
String providerName =
(String)env.get(javax.sql.rowset.spi.SyncFactory.ROWSET_SYNC_PROVIDER);
// set the Reader, this maybe overridden latter
provider = SyncFactory.getInstance(providerName);
// xmlReader = provider.getRowSetReader();
// xmlWriter = provider.getRowSetWriter();
}
/**
* Populates this <code>WebRowSet</code> object with the
* data in the given <code>ResultSet</code> object and writes itself
* to the given <code>java.io.Writer</code> object in XML format.
* This includes the rowset's data, properties, and metadata.
*
* @throws SQLException if an error occurs writing out the rowset
* contents to XML
*/
public void writeXml(ResultSet rs, java.io.Writer writer)
throws SQLException {
// WebRowSetImpl wrs = new WebRowSetImpl();
this.populate(rs);
// Store the cursor position before writing
curPosBfrWrite = this.getRow();
this.writeXml(writer);
}
/**
* Writes this <code>WebRowSet</code> object to the given
* <code>java.io.Writer</code> object in XML format. This
* includes the rowset's data, properties, and metadata.
*
* @throws SQLException if an error occurs writing out the rowset
* contents to XML
*/
public void writeXml(java.io.Writer writer) throws SQLException {
// %%%
// This will change to a XmlReader, which over-rides the default
// Xml that is used when a WRS is instantiated.
// WebRowSetXmlWriter xmlWriter = getXmlWriter();
if (xmlWriter != null) {
// Store the cursor position before writing
curPosBfrWrite = this.getRow();
xmlWriter.writeXML(this, writer);
} else {
throw new SQLException(resBundle.handleGetObject("webrowsetimpl.invalidwr").toString());
}
}
/**
* Reads this <code>WebRowSet</code> object in its XML format.
*
* @throws SQLException if a database access error occurs
*/
public void readXml(java.io.Reader reader) throws SQLException {
// %%%
// This will change to a XmlReader, which over-rides the default
// Xml that is used when a WRS is instantiated.
//WebRowSetXmlReader xmlReader = getXmlReader();
try {
if (reader != null) {
xmlReader.readXML(this, reader);
// Position is before the first row
// The cursor position is to be stored while serializng
// and deserializing the WebRowSet Object.
if(curPosBfrWrite == 0) {
this.beforeFirst();
}
// Return the position back to place prior to callin writeXml
else {
this.absolute(curPosBfrWrite);
}
} else {
throw new SQLException(resBundle.handleGetObject("webrowsetimpl.invalidrd").toString());
}
} catch (Exception e) {
throw new SQLException(e.getMessage());
}
}
// Stream based methods
/**
* Reads a stream based XML input to populate this <code>WebRowSet</code>
* object.
*
* @throws SQLException if a data source access error occurs
* @throws IOException if a IO exception occurs
*/
public void readXml(java.io.InputStream iStream) throws SQLException, IOException {
if (iStream != null) {
xmlReader.readXML(this, iStream);
// Position is before the first row
// The cursor position is to be stored while serializng
// and deserializing the WebRowSet Object.
if(curPosBfrWrite == 0) {
this.beforeFirst();
}
// Return the position back to place prior to callin writeXml
else {
this.absolute(curPosBfrWrite);
}
} else {
throw new SQLException(resBundle.handleGetObject("webrowsetimpl.invalidrd").toString());
}
}
/**
* Writes this <code>WebRowSet</code> object to the given <code> OutputStream</code>
* object in XML format.
* Creates an output stream of the internal state and contents of a
* <code>WebRowSet</code> for XML proceessing
*
* @throws SQLException if a datasource access error occurs
* @throws IOException if an IO exception occurs
*/
public void writeXml(java.io.OutputStream oStream) throws SQLException, IOException {
if (xmlWriter != null) {
// Store the cursor position before writing
curPosBfrWrite = this.getRow();
xmlWriter.writeXML(this, oStream);
} else {
throw new SQLException(resBundle.handleGetObject("webrowsetimpl.invalidwr").toString());
}
}
/**
* Populates this <code>WebRowSet</code> object with the
* data in the given <code>ResultSet</code> object and writes itself
* to the given <code>java.io.OutputStream</code> object in XML format.
* This includes the rowset's data, properties, and metadata.
*
* @throws SQLException if a datasource access error occurs
* @throws IOException if an IO exception occurs
*/
public void writeXml(ResultSet rs, java.io.OutputStream oStream) throws SQLException, IOException {
this.populate(rs);
// Store the cursor position before writing
curPosBfrWrite = this.getRow();
this.writeXml(oStream);
}
/**
* This method re populates the resBundle
* during the deserialization process
*
*/
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
// Default state initialization happens here
ois.defaultReadObject();
// Initialization of transient Res Bundle happens here .
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
static final long serialVersionUID = -8771775154092422943L;
}

View file

@ -0,0 +1,101 @@
/*
* Copyright (c) 2003, 2013, 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.internal;
import java.sql.*;
import java.io.*;
import java.util.Arrays;
/**
* The abstract base class from which the classes <code>Row</code>
* The class <code>BaseRow</code> stores
* a row's original values as an array of <code>Object</code>
* values, which can be retrieved with the method <code>getOrigRow</code>.
* This class also provides methods for getting and setting individual
* values in the row.
* <P>
* A row's original values are the values it contained before it was last
* modified. For example, when the <code>CachedRowSet</code>method
* <code>acceptChanges</code> is called, it will reset a row's original
* values to be the row's current values. Then, when the row is modified,
* the values that were previously the current values will become the row's
* original values (the values the row had immediately before it was modified).
* If a row has not been modified, its original values are its initial values.
* <P>
* Subclasses of this class contain more specific details, such as
* the conditions under which an exception is thrown or the bounds for
* index parameters.
*/
public abstract class BaseRow implements Serializable, Cloneable {
/**
* Specify the serialVersionUID
*/
private static final long serialVersionUID = 4152013523511412238L;
/**
* The array containing the original values for this <code>BaseRow</code>
* object.
* @serial
*/
protected Object[] origVals;
/**
* Retrieves the values that this row contained immediately
* prior to its last modification.
*
* @return an array of <code>Object</code> values containing this row's
* original values
*/
public Object[] getOrigRow() {
Object[] origRow = this.origVals;
return (origRow == null) ? null: Arrays.copyOf(origRow, origRow.length);
}
/**
* Retrieves the array element at the given index, which is
* the original value of column number <i>idx</i> in this row.
*
* @param idx the index of the element to return
* @return the <code>Object</code> value at the given index into this
* row's array of original values
* @throws SQLException if there is an error
*/
public abstract Object getColumnObject(int idx) throws SQLException;
/**
* Sets the element at the given index into this row's array of
* original values to the given value. Implementations of the classes
* <code>Row</code> and determine what happens
* when the cursor is on the insert row and when it is on any other row.
*
* @param idx the index of the element to be set
* @param obj the <code>Object</code> to which the element at index
* <code>idx</code> to be set
* @throws SQLException if there is an error
*/
public abstract void setColumnObject(int idx, Object obj) throws SQLException;
}

View file

@ -0,0 +1,510 @@
/*
* Copyright (c) 2003, 2011, 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.internal;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import java.io.*;
import java.lang.reflect.*;
import com.sun.rowset.*;
import javax.sql.rowset.*;
import javax.sql.rowset.spi.*;
/**
* The facility called by the <code>RIOptimisticProvider</code> object
* internally to read data into it. The calling <code>RowSet</code> object
* must have implemented the <code>RowSetInternal</code> interface
* and have the standard <code>CachedRowSetReader</code> object set as its
* reader.
* <P>
* This implementation always reads all rows of the data source,
* and it assumes that the <code>command</code> property for the caller
* is set with a query that is appropriate for execution by a
* <code>PreparedStatement</code> object.
* <P>
* Typically the <code>SyncFactory</code> manages the <code>RowSetReader</code> and
* the <code>RowSetWriter</code> implementations using <code>SyncProvider</code> objects.
* Standard JDBC RowSet implementations provide an object instance of this
* reader by invoking the <code>SyncProvider.getRowSetReader()</code> method.
*
* @author Jonathan Bruce
* @see javax.sql.rowset.spi.SyncProvider
* @see javax.sql.rowset.spi.SyncFactory
* @see javax.sql.rowset.spi.SyncFactoryException
*/
public class CachedRowSetReader implements RowSetReader, Serializable {
/**
* The field that keeps track of whether the writer associated with
* this <code>CachedRowSetReader</code> object's rowset has been called since
* the rowset was populated.
* <P>
* When this <code>CachedRowSetReader</code> object reads data into
* its rowset, it sets the field <code>writerCalls</code> to 0.
* When the writer associated with the rowset is called to write
* data back to the underlying data source, its <code>writeData</code>
* method calls the method <code>CachedRowSetReader.reset</code>,
* which increments <code>writerCalls</code> and returns <code>true</code>
* if <code>writerCalls</code> is 1. Thus, <code>writerCalls</code> equals
* 1 after the first call to <code>writeData</code> that occurs
* after the rowset has had data read into it.
*
* @serial
*/
private int writerCalls = 0;
private boolean userCon = false;
private int startPosition;
private JdbcRowSetResourceBundle resBundle;
public CachedRowSetReader() {
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
/**
* Reads data from a data source and populates the given
* <code>RowSet</code> object with that data.
* This method is called by the rowset internally when
* the application invokes the method <code>execute</code>
* to read a new set of rows.
* <P>
* After clearing the rowset of its contents, if any, and setting
* the number of writer calls to <code>0</code>, this reader calls
* its <code>connect</code> method to make
* a connection to the rowset's data source. Depending on which
* of the rowset's properties have been set, the <code>connect</code>
* method will use a <code>DataSource</code> object or the
* <code>DriverManager</code> facility to make a connection to the
* data source.
* <P>
* Once the connection to the data source is made, this reader
* executes the query in the calling <code>CachedRowSet</code> object's
* <code>command</code> property. Then it calls the rowset's
* <code>populate</code> method, which reads data from the
* <code>ResultSet</code> object produced by executing the rowset's
* command. The rowset is then populated with this data.
* <P>
* This method's final act is to close the connection it made, thus
* leaving the rowset disconnected from its data source.
*
* @param caller a <code>RowSet</code> object that has implemented
* the <code>RowSetInternal</code> interface and had
* this <code>CachedRowSetReader</code> object set as
* its reader
* @throws SQLException if there is a database access error, there is a
* problem making the connection, or the command property has not
* been set
*/
public void readData(RowSetInternal caller) throws SQLException
{
Connection con = null;
try {
CachedRowSet crs = (CachedRowSet)caller;
// Get rid of the current contents of the rowset.
/**
* Checking added to verify whether page size has been set or not.
* If set then do not close the object as certain parameters need
* to be maintained.
*/
if(crs.getPageSize() == 0 && crs.size() >0 ) {
// When page size is not set,
// crs.size() will show the total no of rows.
crs.close();
}
writerCalls = 0;
// Get a connection. This reader assumes that the necessary
// properties have been set on the caller to let it supply a
// connection.
userCon = false;
con = this.connect(caller);
// Check our assumptions.
if (con == null || crs.getCommand() == null)
throw new SQLException(resBundle.handleGetObject("crsreader.connecterr").toString());
try {
con.setTransactionIsolation(crs.getTransactionIsolation());
} catch (Exception ex) {
;
}
// Use JDBC to read the data.
PreparedStatement pstmt = con.prepareStatement(crs.getCommand());
// Pass any input parameters to JDBC.
decodeParams(caller.getParams(), pstmt);
try {
pstmt.setMaxRows(crs.getMaxRows());
pstmt.setMaxFieldSize(crs.getMaxFieldSize());
pstmt.setEscapeProcessing(crs.getEscapeProcessing());
pstmt.setQueryTimeout(crs.getQueryTimeout());
} catch (Exception ex) {
/*
* drivers may not support the above - esp. older
* drivers being used by the bridge..
*/
throw new SQLException(ex.getMessage());
}
if(crs.getCommand().toLowerCase().indexOf("select") != -1) {
// can be (crs.getCommand()).indexOf("select")) == 0
// because we will be getting resultset when
// it may be the case that some false select query with
// select coming in between instead of first.
// if ((crs.getCommand()).indexOf("?")) does not return -1
// implies a Prepared Statement like query exists.
ResultSet rs = pstmt.executeQuery();
if(crs.getPageSize() == 0){
crs.populate(rs);
}
else {
/**
* If page size has been set then create a ResultSet object that is scrollable using a
* PreparedStatement handle.Also call the populate(ResultSet,int) function to populate
* a page of data as specified by the page size.
*/
pstmt = con.prepareStatement(crs.getCommand(),ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
decodeParams(caller.getParams(), pstmt);
try {
pstmt.setMaxRows(crs.getMaxRows());
pstmt.setMaxFieldSize(crs.getMaxFieldSize());
pstmt.setEscapeProcessing(crs.getEscapeProcessing());
pstmt.setQueryTimeout(crs.getQueryTimeout());
} catch (Exception ex) {
/*
* drivers may not support the above - esp. older
* drivers being used by the bridge..
*/
throw new SQLException(ex.getMessage());
}
rs = pstmt.executeQuery();
crs.populate(rs,startPosition);
}
rs.close();
} else {
pstmt.executeUpdate();
}
// Get the data.
pstmt.close();
try {
con.commit();
} catch (SQLException ex) {
;
}
// only close connections we created...
if (getCloseConnection() == true)
con.close();
}
catch (SQLException ex) {
// Throw an exception if reading fails for any reason.
throw ex;
} finally {
try {
// only close connections we created...
if (con != null && getCloseConnection() == true) {
try {
if (!con.getAutoCommit()) {
con.rollback();
}
} catch (Exception dummy) {
/*
* not an error condition, we're closing anyway, but
* we'd like to clean up any locks if we can since
* it is not clear the connection pool will clean
* these connections in a timely manner
*/
}
con.close();
con = null;
}
} catch (SQLException e) {
// will get exception if something already went wrong, but don't
// override that exception with this one
}
}
}
/**
* Checks to see if the writer associated with this reader needs
* to reset its state. The writer will need to initialize its state
* if new contents have been read since the writer was last called.
* This method is called by the writer that was registered with
* this reader when components were being wired together.
*
* @return <code>true</code> if writer associated with this reader needs
* to reset the values of its fields; <code>false</code> otherwise
* @throws SQLException if an access error occurs
*/
public boolean reset() throws SQLException {
writerCalls++;
return writerCalls == 1;
}
/**
* Establishes a connection with the data source for the given
* <code>RowSet</code> object. If the rowset's <code>dataSourceName</code>
* property has been set, this method uses the JNDI API to retrieve the
* <code>DataSource</code> object that it can use to make the connection.
* If the url, username, and password properties have been set, this
* method uses the <code>DriverManager.getConnection</code> method to
* make the connection.
* <P>
* This method is used internally by the reader and writer associated with
* the calling <code>RowSet</code> object; an application never calls it
* directly.
*
* @param caller a <code>RowSet</code> object that has implemented
* the <code>RowSetInternal</code> interface and had
* this <code>CachedRowSetReader</code> object set as
* its reader
* @return a <code>Connection</code> object that represents a connection
* to the caller's data source
* @throws SQLException if an access error occurs
*/
public Connection connect(RowSetInternal caller) throws SQLException {
// Get a JDBC connection.
if (caller.getConnection() != null) {
// A connection was passed to execute(), so use it.
// As we are using a connection the user gave us we
// won't close it.
userCon = true;
return caller.getConnection();
}
else if (((RowSet)caller).getDataSourceName() != null) {
// Connect using JNDI.
try {
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup
(((RowSet)caller).getDataSourceName());
// Check for username, password,
// if it exists try getting a Connection handle through them
// else try without these
// else throw SQLException
if(((RowSet)caller).getUsername() != null) {
return ds.getConnection(((RowSet)caller).getUsername(),
((RowSet)caller).getPassword());
} else {
return ds.getConnection();
}
}
catch (javax.naming.NamingException ex) {
SQLException sqlEx = new SQLException(resBundle.handleGetObject("crsreader.connect").toString());
sqlEx.initCause(ex);
throw sqlEx;
}
} else if (((RowSet)caller).getUrl() != null) {
// Connect using the driver manager.
return DriverManager.getConnection(((RowSet)caller).getUrl(),
((RowSet)caller).getUsername(),
((RowSet)caller).getPassword());
}
else {
return null;
}
}
/**
* Sets the parameter placeholders
* in the rowset's command (the given <code>PreparedStatement</code>
* object) with the parameters in the given array.
* This method, called internally by the method
* <code>CachedRowSetReader.readData</code>, reads each parameter, and
* based on its type, determines the correct
* <code>PreparedStatement.setXXX</code> method to use for setting
* that parameter.
*
* @param params an array of parameters to be used with the given
* <code>PreparedStatement</code> object
* @param pstmt the <code>PreparedStatement</code> object that is the
* command for the calling rowset and into which
* the given parameters are to be set
* @throws SQLException if an access error occurs
*/
@SuppressWarnings("deprecation")
private void decodeParams(Object[] params,
PreparedStatement pstmt) throws SQLException {
// There is a corresponding decodeParams in JdbcRowSetImpl
// which does the same as this method. This is a design flaw.
// Update the JdbcRowSetImpl.decodeParams when you update
// this method.
// Adding the same comments to JdbcRowSetImpl.decodeParams.
int arraySize;
Object[] param = null;
for (int i=0; i < params.length; i++) {
if (params[i] instanceof Object[]) {
param = (Object[])params[i];
if (param.length == 2) {
if (param[0] == null) {
pstmt.setNull(i + 1, ((Integer)param[1]).intValue());
continue;
}
if (param[0] instanceof java.sql.Date ||
param[0] instanceof java.sql.Time ||
param[0] instanceof java.sql.Timestamp) {
System.err.println(resBundle.handleGetObject("crsreader.datedetected").toString());
if (param[1] instanceof java.util.Calendar) {
System.err.println(resBundle.handleGetObject("crsreader.caldetected").toString());
pstmt.setDate(i + 1, (java.sql.Date)param[0],
(java.util.Calendar)param[1]);
continue;
}
else {
throw new SQLException(resBundle.handleGetObject("crsreader.paramtype").toString());
}
}
if (param[0] instanceof Reader) {
pstmt.setCharacterStream(i + 1, (Reader)param[0],
((Integer)param[1]).intValue());
continue;
}
/*
* What's left should be setObject(int, Object, scale)
*/
if (param[1] instanceof Integer) {
pstmt.setObject(i + 1, param[0], ((Integer)param[1]).intValue());
continue;
}
} else if (param.length == 3) {
if (param[0] == null) {
pstmt.setNull(i + 1, ((Integer)param[1]).intValue(),
(String)param[2]);
continue;
}
if (param[0] instanceof java.io.InputStream) {
switch (((Integer)param[2]).intValue()) {
case CachedRowSetImpl.UNICODE_STREAM_PARAM:
pstmt.setUnicodeStream(i + 1,
(java.io.InputStream)param[0],
((Integer)param[1]).intValue());
break;
case CachedRowSetImpl.BINARY_STREAM_PARAM:
pstmt.setBinaryStream(i + 1,
(java.io.InputStream)param[0],
((Integer)param[1]).intValue());
break;
case CachedRowSetImpl.ASCII_STREAM_PARAM:
pstmt.setAsciiStream(i + 1,
(java.io.InputStream)param[0],
((Integer)param[1]).intValue());
break;
default:
throw new SQLException(resBundle.handleGetObject("crsreader.paramtype").toString());
}
}
/*
* no point at looking at the first element now;
* what's left must be the setObject() cases.
*/
if (param[1] instanceof Integer && param[2] instanceof Integer) {
pstmt.setObject(i + 1, param[0], ((Integer)param[1]).intValue(),
((Integer)param[2]).intValue());
continue;
}
throw new SQLException(resBundle.handleGetObject("crsreader.paramtype").toString());
} else {
// common case - this catches all SQL92 types
pstmt.setObject(i + 1, params[i]);
continue;
}
} else {
// Try to get all the params to be set here
pstmt.setObject(i + 1, params[i]);
}
}
}
/**
* Assists in determining whether the current connection was created by this
* CachedRowSet to ensure incorrect connections are not prematurely terminated.
*
* @return a boolean giving the status of whether the connection has been closed.
*/
protected boolean getCloseConnection() {
if (userCon == true)
return false;
return true;
}
/**
* This sets the start position in the ResultSet from where to begin. This is
* called by the Reader in the CachedRowSetImpl to set the position on the page
* to begin populating from.
* @param pos integer indicating the position in the <code>ResultSet</code> to begin
* populating from.
*/
public void setStartPosition(int pos){
startPosition = pos;
}
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
// Default state initialization happens here
ois.defaultReadObject();
// Initialization of Res Bundle happens here .
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
static final long serialVersionUID =5049738185801363801L;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,179 @@
/*
* 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
* 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.internal;
import com.sun.rowset.JdbcRowSetResourceBundle;
import java.sql.*;
import javax.sql.*;
import java.io.*;
import java.util.*;
/**
* A class used internally to manage a <code>CachedRowSet</code> object's
* insert row. This class keeps track of the number of columns in the
* insert row and which columns have had a value inserted. It provides
* methods for retrieving a column value, setting a column value, and finding
* out whether the insert row is complete.
*/
public class InsertRow extends BaseRow implements Serializable, Cloneable {
/**
* An internal <code>BitSet</code> object used to keep track of the
* columns in this <code>InsertRow</code> object that have had a value
* inserted.
*/
private BitSet colsInserted;
/**
* The number of columns in this <code>InsertRow</code> object.
*/
private int cols;
private JdbcRowSetResourceBundle resBundle;
/**
* Creates an <code>InsertRow</code> object initialized with the
* given number of columns, an array for keeping track of the
* original values in this insert row, and a
* <code>BitSet</code> object with the same number of bits as
* there are columns.
*
* @param numCols an <code>int</code> indicating the number of columns
* in this <code>InsertRow</code> object
*/
public InsertRow(int numCols) {
origVals = new Object[numCols];
colsInserted = new BitSet(numCols);
cols = numCols;
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
/**
* Sets the bit in this <code>InsertRow</code> object's internal
* <code>BitSet</code> object that corresponds to the specified column
* in this <code>InsertRow</code> object. Setting a bit indicates
* that a value has been set.
*
* @param col the number of the column to be marked as inserted;
* the first column is <code>1</code>
*/
protected void markColInserted(int col) {
colsInserted.set(col);
}
/**
* Indicates whether this <code>InsertRow</code> object has a value
* for every column that cannot be null.
* @param RowSetMD the <code>RowSetMetaData</code> object for the
* <code>CachedRowSet</code> object that maintains this
* <code>InsertRow</code> object
* @return <code>true</code> if this <code>InsertRow</code> object is
* complete; <code>false</code> otherwise
* @throws SQLException if there is an error accessing data
*/
public boolean isCompleteRow(RowSetMetaData RowSetMD) throws SQLException {
for (int i = 0; i < cols; i++) {
if (colsInserted.get(i) == false &&
RowSetMD.isNullable(i + 1) ==
ResultSetMetaData.columnNoNulls) {
return false;
}
}
return true;
}
/**
* Clears all the bits in the internal <code>BitSet</code> object
* maintained by this <code>InsertRow</code> object. Clearing all the bits
* indicates that none of the columns have had a value inserted.
*/
public void initInsertRow() {
for (int i = 0; i < cols; i++) {
colsInserted.clear(i);
}
}
/**
* Retrieves the value of the designated column in this
* <code>InsertRow</code> object. If no value has been inserted
* into the designated column, this method throws an
* <code>SQLException</code>.
*
* @param idx the column number of the value to be retrieved;
* the first column is <code>1</code>
* @throws SQLException if no value has been inserted into
* the designated column
*/
public Object getColumnObject(int idx) throws SQLException {
if (colsInserted.get(idx - 1) == false) {
throw new SQLException(resBundle.handleGetObject("insertrow.novalue").toString());
}
return (origVals[idx - 1]);
}
/**
* Sets the element in this <code>InsertRow</code> object's
* internal array of original values that corresponds to the
* designated column with the given value. If the third
* argument is <code>true</code>,
* which means that the cursor is on the insert row, this
* <code>InsertRow</code> object's internal <code>BitSet</code> object
* is set so that the bit corresponding to the column being set is
* turned on.
*
* @param idx the number of the column in the insert row to be set;
* the first column is <code>1</code>
* @param val the value to be set
*/
public void setColumnObject(int idx, Object val) {
origVals[idx - 1] = val;
markColInserted(idx - 1);
}
/**
* This method re populates the resBundle
* during the deserialization process
*
*/
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
// Default state initialization happens here
ois.defaultReadObject();
// Initialization of transient Res Bundle happens here .
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
static final long serialVersionUID = 1066099658102869344L;
}

View file

@ -0,0 +1,341 @@
/*
* Copyright (c) 2003, 2011, 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.internal;
import java.sql.*;
import java.io.*;
import java.lang.*;
import java.util.*;
/**
* A class that keeps track of a row's values. A <code>Row</code> object
* maintains an array of current column values and an array of original
* column values, and it provides methods for getting and setting the
* value of a column. It also keeps track of which columns have
* changed and whether the change was a delete, insert, or update.
* <P>
* Note that column numbers for rowsets start at <code>1</code>,
* whereas the first element of an array or bitset is <code>0</code>.
* The argument for the method <code>getColumnUpdated</code> refers to
* the column number in the rowset (the first column is <code>1</code>);
* the argument for <code>setColumnUpdated</code> refers to the index
* into the rowset's internal bitset (the first bit is <code>0</code>).
*/
public class Row extends BaseRow implements Serializable, Cloneable {
static final long serialVersionUID = 5047859032611314762L;
/**
* An array containing the current column values for this <code>Row</code>
* object.
* @serial
*/
private Object[] currentVals;
/**
* A <code>BitSet</code> object containing a flag for each column in
* this <code>Row</code> object, with each flag indicating whether or
* not the value in the column has been changed.
* @serial
*/
private BitSet colsChanged;
/**
* A <code>boolean</code> indicating whether or not this <code>Row</code>
* object has been deleted. <code>true</code> indicates that it has
* been deleted; <code>false</code> indicates that it has not.
* @serial
*/
private boolean deleted;
/**
* A <code>boolean</code> indicating whether or not this <code>Row</code>
* object has been updated. <code>true</code> indicates that it has
* been updated; <code>false</code> indicates that it has not.
* @serial
*/
private boolean updated;
/**
* A <code>boolean</code> indicating whether or not this <code>Row</code>
* object has been inserted. <code>true</code> indicates that it has
* been inserted; <code>false</code> indicates that it has not.
* @serial
*/
private boolean inserted;
/**
* The number of columns in this <code>Row</code> object.
* @serial
*/
private int numCols;
/**
* Creates a new <code>Row</code> object with the given number of columns.
* The newly-created row includes an array of original values,
* an array for storing its current values, and a <code>BitSet</code>
* object for keeping track of which column values have been changed.
*/
public Row(int numCols) {
origVals = new Object[numCols];
currentVals = new Object[numCols];
colsChanged = new BitSet(numCols);
this.numCols = numCols;
}
/**
* Creates a new <code>Row</code> object with the given number of columns
* and with its array of original values initialized to the given array.
* The new <code>Row</code> object also has an array for storing its
* current values and a <code>BitSet</code> object for keeping track
* of which column values have been changed.
*/
public Row(int numCols, Object[] vals) {
origVals = new Object[numCols];
System.arraycopy(vals, 0, origVals, 0, numCols);
currentVals = new Object[numCols];
colsChanged = new BitSet(numCols);
this.numCols = numCols;
}
/**
*
* This method is called internally by the <code>CachedRowSet.populate</code>
* methods.
*
* @param idx the number of the column in this <code>Row</code> object
* that is to be set; the index of the first column is
* <code>1</code>
* @param val the new value to be set
*/
public void initColumnObject(int idx, Object val) {
origVals[idx - 1] = val;
}
/**
*
* This method is called internally by the <code>CachedRowSet.updateXXX</code>
* methods.
*
* @param idx the number of the column in this <code>Row</code> object
* that is to be set; the index of the first column is
* <code>1</code>
* @param val the new value to be set
*/
public void setColumnObject(int idx, Object val) {
currentVals[idx - 1] = val;
setColUpdated(idx - 1);
}
/**
* Retrieves the column value stored in the designated column of this
* <code>Row</code> object.
*
* @param columnIndex the index of the column value to be retrieved;
* the index of the first column is <code>1</code>
* @return an <code>Object</code> in the Java programming language that
* represents the value stored in the designated column
* @throws SQLException if there is a database access error
*/
public Object getColumnObject(int columnIndex) throws SQLException {
if (getColUpdated(columnIndex - 1)) {
return(currentVals[columnIndex - 1]); // maps to array!!
} else {
return(origVals[columnIndex - 1]); // maps to array!!
}
}
/**
* Indicates whether the designated column of this <code>Row</code> object
* has been changed.
* @param idx the index into the <code>BitSet</code> object maintained by
* this <code>Row</code> object to keep track of which column
* values have been modified; the index of the first bit is
* <code>0</code>
* @return <code>true</code> if the designated column value has been changed;
* <code>false</code> otherwise
*
*/
public boolean getColUpdated(int idx) {
return colsChanged.get(idx);
}
/**
* Sets this <code>Row</code> object's <code>deleted</code> field
* to <code>true</code>.
*
* @see #getDeleted
*/
public void setDeleted() { // %%% was public
deleted = true;
}
/**
* Retrieves the value of this <code>Row</code> object's <code>deleted</code> field,
* which will be <code>true</code> if one or more of its columns has been
* deleted.
* @return <code>true</code> if a column value has been deleted; <code>false</code>
* otherwise
*
* @see #setDeleted
*/
public boolean getDeleted() {
return(deleted);
}
/**
* Sets the <code>deleted</code> field for this <code>Row</code> object to
* <code>false</code>.
*/
public void clearDeleted() {
deleted = false;
}
/**
* Sets the value of this <code>Row</code> object's <code>inserted</code> field
* to <code>true</code>.
*
* @see #getInserted
*/
public void setInserted() {
inserted = true;
}
/**
* Retrieves the value of this <code>Row</code> object's <code>inserted</code> field,
* which will be <code>true</code> if this row has been inserted.
* @return <code>true</code> if this row has been inserted; <code>false</code>
* otherwise
*
* @see #setInserted
*/
public boolean getInserted() {
return(inserted);
}
/**
* Sets the <code>inserted</code> field for this <code>Row</code> object to
* <code>false</code>.
*/
public void clearInserted() { // %%% was public
inserted = false;
}
/**
* Retrieves the value of this <code>Row</code> object's
* <code>updated</code> field.
* @return <code>true</code> if this <code>Row</code> object has been
* updated; <code>false</code> if it has not
*
* @see #setUpdated
*/
public boolean getUpdated() {
return(updated);
}
/**
* Sets the <code>updated</code> field for this <code>Row</code> object to
* <code>true</code> if one or more of its column values has been changed.
*
* @see #getUpdated
*/
public void setUpdated() {
// only mark something as updated if one or
// more of the columns has been changed.
for (int i = 0; i < numCols; i++) {
if (getColUpdated(i) == true) {
updated = true;
return;
}
}
}
/**
* Sets the bit at the given index into this <code>Row</code> object's internal
* <code>BitSet</code> object, indicating that the corresponding column value
* (column <code>idx</code> + 1) has been changed.
*
* @param idx the index into the <code>BitSet</code> object maintained by
* this <code>Row</code> object; the first bit is at index
* <code>0</code>
*
*/
private void setColUpdated(int idx) {
colsChanged.set(idx);
}
/**
* Sets the <code>updated</code> field for this <code>Row</code> object to
* <code>false</code>, sets all the column values in this <code>Row</code>
* object's internal array of current values to <code>null</code>, and clears
* all of the bits in the <code>BitSet</code> object maintained by this
* <code>Row</code> object.
*/
public void clearUpdated() {
updated = false;
for (int i = 0; i < numCols; i++) {
currentVals[i] = null;
colsChanged.clear(i);
}
}
/**
* Sets the column values in this <code>Row</code> object's internal
* array of original values with the values in its internal array of
* current values, sets all the values in this <code>Row</code>
* object's internal array of current values to <code>null</code>,
* clears all the bits in this <code>Row</code> object's internal bitset,
* and sets its <code>updated</code> field to <code>false</code>.
* <P>
* This method is called internally by the <code>CachedRowSet</code>
* method <code>makeRowOriginal</code>.
*/
public void moveCurrentToOrig() {
for (int i = 0; i < numCols; i++) {
if (getColUpdated(i) == true) {
origVals[i] = currentVals[i];
currentVals[i] = null;
colsChanged.clear(i);
}
}
updated = false;
}
/**
* Returns the row on which the cursor is positioned.
*
* @return the <code>Row</code> object on which the <code>CachedRowSet</code>
* implementation objects's cursor is positioned
*/
public BaseRow getCurrentRow() {
return null;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,237 @@
/*
* 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
* 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.internal;
import java.sql.*;
import javax.sql.*;
import java.io.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import com.sun.rowset.*;
import java.text.MessageFormat;
import javax.sql.rowset.*;
import javax.sql.rowset.spi.*;
/**
* An implementation of the <code>XmlReader</code> interface, which
* reads and parses an XML formatted <code>WebRowSet</code> object.
* This implementation uses an <code>org.xml.sax.Parser</code> object
* as its parser.
*/
public class WebRowSetXmlReader implements XmlReader, Serializable {
private JdbcRowSetResourceBundle resBundle;
public WebRowSetXmlReader(){
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
/**
* Parses the given <code>WebRowSet</code> object, getting its input from
* the given <code>java.io.Reader</code> object. The parser will send
* notifications of parse events to the rowset's
* <code>XmlReaderDocHandler</code>, which will build the rowset as
* an XML document.
* <P>
* This method is called internally by the method
* <code>WebRowSet.readXml</code>.
* <P>
* If a parsing error occurs, the exception thrown will include
* information for locating the error in the original XML document.
*
* @param caller the <code>WebRowSet</code> object to be parsed, whose
* <code>xmlReader</code> field must contain a reference to
* this <code>XmlReader</code> object
* @param reader the <code>java.io.Reader</code> object from which
* the parser will get its input
* @exception SQLException if a database access error occurs or
* this <code>WebRowSetXmlReader</code> object is not the
* reader for the given rowset
* @see XmlReaderContentHandler
*/
public void readXML(WebRowSet caller, java.io.Reader reader) throws SQLException {
try {
// Crimson Parser(as in J2SE 1.4.1 is NOT able to handle
// Reader(s)(FileReader).
//
// But getting the file as a Stream works fine. So we are going to take
// the reader but send it as a InputStream to the parser. Note that this
// functionality needs to work against any parser
// Crimson(J2SE 1.4.x) / Xerces(J2SE 1.5.x).
InputSource is = new InputSource(reader);
DefaultHandler dh = new XmlErrorHandler();
XmlReaderContentHandler hndr = new XmlReaderContentHandler((RowSet)caller);
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
SAXParser parser = factory.newSAXParser() ;
parser.setProperty(
"http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
XMLReader reader1 = parser.getXMLReader() ;
reader1.setEntityResolver(new XmlResolver());
reader1.setContentHandler(hndr);
reader1.setErrorHandler(dh);
reader1.parse(is);
} catch (SAXParseException err) {
System.out.println (MessageFormat.format(resBundle.handleGetObject("wrsxmlreader.parseerr").toString(), new Object[]{ err.getMessage (), err.getLineNumber(), err.getSystemId()}));
err.printStackTrace();
throw new SQLException(err.getMessage());
} catch (SAXException e) {
Exception x = e;
if (e.getException () != null)
x = e.getException();
x.printStackTrace ();
throw new SQLException(x.getMessage());
}
// Will be here if trying to write beyond the RowSet limits
catch (ArrayIndexOutOfBoundsException aie) {
throw new SQLException(resBundle.handleGetObject("wrsxmlreader.invalidcp").toString());
}
catch (Throwable e) {
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("wrsxmlreader.readxml").toString() , e.getMessage()));
}
}
/**
* Parses the given <code>WebRowSet</code> object, getting its input from
* the given <code>java.io.InputStream</code> object. The parser will send
* notifications of parse events to the rowset's
* <code>XmlReaderDocHandler</code>, which will build the rowset as
* an XML document.
* <P>
* Using streams is a much faster way than using <code>java.io.Reader</code>
* <P>
* This method is called internally by the method
* <code>WebRowSet.readXml</code>.
* <P>
* If a parsing error occurs, the exception thrown will include
* information for locating the error in the original XML document.
*
* @param caller the <code>WebRowSet</code> object to be parsed, whose
* <code>xmlReader</code> field must contain a reference to
* this <code>XmlReader</code> object
* @param iStream the <code>java.io.InputStream</code> object from which
* the parser will get its input
* @throws SQLException if a database access error occurs or
* this <code>WebRowSetXmlReader</code> object is not the
* reader for the given rowset
* @see XmlReaderContentHandler
*/
public void readXML(WebRowSet caller, java.io.InputStream iStream) throws SQLException {
try {
InputSource is = new InputSource(iStream);
DefaultHandler dh = new XmlErrorHandler();
XmlReaderContentHandler hndr = new XmlReaderContentHandler((RowSet)caller);
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
SAXParser parser = factory.newSAXParser() ;
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
XMLReader reader1 = parser.getXMLReader() ;
reader1.setEntityResolver(new XmlResolver());
reader1.setContentHandler(hndr);
reader1.setErrorHandler(dh);
reader1.parse(is);
} catch (SAXParseException err) {
System.out.println (MessageFormat.format(resBundle.handleGetObject("wrsxmlreader.parseerr").toString(), new Object[]{err.getLineNumber(), err.getSystemId() }));
System.out.println(" " + err.getMessage ());
err.printStackTrace();
throw new SQLException(err.getMessage());
} catch (SAXException e) {
Exception x = e;
if (e.getException () != null)
x = e.getException();
x.printStackTrace ();
throw new SQLException(x.getMessage());
}
// Will be here if trying to write beyond the RowSet limits
catch (ArrayIndexOutOfBoundsException aie) {
throw new SQLException(resBundle.handleGetObject("wrsxmlreader.invalidcp").toString());
}
catch (Throwable e) {
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("wrsxmlreader.readxml").toString() , e.getMessage()));
}
}
/**
* For code coverage purposes only right now
*
*/
public void readData(RowSetInternal caller) {
}
/**
* This method re populates the resBundle
* during the deserialization process
*
*/
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
// Default state initialization happens here
ois.defaultReadObject();
// Initialization of transient Res Bundle happens here .
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
static final long serialVersionUID = -9127058392819008014L;
}

View file

@ -0,0 +1,680 @@
/*
* Copyright (c) 2003, 2012, 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.internal;
import com.sun.rowset.JdbcRowSetResourceBundle;
import java.sql.*;
import javax.sql.*;
import java.io.*;
import java.text.MessageFormat;
import java.util.*;
import javax.sql.rowset.*;
import javax.sql.rowset.spi.*;
/**
* An implementation of the {@code XmlWriter} interface, which writes a
* {@code WebRowSet} object to an output stream as an XML document.
*/
public class WebRowSetXmlWriter implements XmlWriter, Serializable {
/**
* The {@code java.io.Writer} object to which this {@code WebRowSetXmlWriter}
* object will write when its {@code writeXML} method is called. The value
* for this field is set with the {@code java.io.Writer} object given
* as the second argument to the {@code writeXML} method.
*/
private transient java.io.Writer writer;
/**
* The {@code java.util.Stack} object that this {@code WebRowSetXmlWriter}
* object will use for storing the tags to be used for writing the calling
* {@code WebRowSet} object as an XML document.
*/
private java.util.Stack<String> stack;
private JdbcRowSetResourceBundle resBundle;
public WebRowSetXmlWriter() {
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
/**
* Writes the given {@code WebRowSet} object as an XML document
* using the given {@code java.io.Writer} object. The XML document
* will include the {@code WebRowSet} object's data, metadata, and
* properties. If a data value has been updated, that information is also
* included.
* <P>
* This method is called by the {@code XmlWriter} object that is
* referenced in the calling {@code WebRowSet} object's
* {@code xmlWriter} field. The {@code XmlWriter.writeXML}
* method passes to this method the arguments that were supplied to it.
*
* @param caller the {@code WebRowSet} object to be written; must
* be a rowset for which this {@code WebRowSetXmlWriter} object
* is the writer
* @param wrt the {@code java.io.Writer} object to which
* {@code caller} will be written
* @exception SQLException if a database access error occurs or
* this {@code WebRowSetXmlWriter} object is not the writer
* for the given rowset
* @see XmlWriter#writeXML
*/
public void writeXML(WebRowSet caller, java.io.Writer wrt)
throws SQLException {
// create a new stack for tag checking.
stack = new java.util.Stack<>();
writer = wrt;
writeRowSet(caller);
}
/**
* Writes the given {@code WebRowSet} object as an XML document
* using the given {@code java.io.OutputStream} object. The XML document
* will include the {@code WebRowSet} object's data, metadata, and
* properties. If a data value has been updated, that information is also
* included.
* <P>
* Using stream is a faster way than using {@code java.io.Writer}
*
* This method is called by the {@code XmlWriter} object that is
* referenced in the calling {@code WebRowSet} object's
* {@code xmlWriter} field. The {@code XmlWriter.writeXML}
* method passes to this method the arguments that were supplied to it.
*
* @param caller the {@code WebRowSet} object to be written; must
* be a rowset for which this {@code WebRowSetXmlWriter} object
* is the writer
* @param oStream the {@code java.io.OutputStream} object to which
* {@code caller} will be written
* @throws SQLException if a database access error occurs or
* this {@code WebRowSetXmlWriter} object is not the writer
* for the given rowset
* @see XmlWriter#writeXML
*/
public void writeXML(WebRowSet caller, java.io.OutputStream oStream)
throws SQLException {
// create a new stack for tag checking.
stack = new java.util.Stack<>();
writer = new OutputStreamWriter(oStream);
writeRowSet(caller);
}
/**
*
*
* @exception SQLException if a database access error occurs
*/
private void writeRowSet(WebRowSet caller) throws SQLException {
try {
startHeader();
writeProperties(caller);
writeMetaData(caller);
writeData(caller);
endHeader();
} catch (java.io.IOException ex) {
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("wrsxmlwriter.ioex").toString(), ex.getMessage()));
}
}
private void startHeader() throws java.io.IOException {
setTag("webRowSet");
writer.write("<?xml version=\"1.0\"?>\n");
writer.write("<webRowSet xmlns=\"http://java.sun.com/xml/ns/jdbc\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
writer.write("xsi:schemaLocation=\"http://java.sun.com/xml/ns/jdbc http://java.sun.com/xml/ns/jdbc/webrowset.xsd\">\n");
}
private void endHeader() throws java.io.IOException {
endTag("webRowSet");
}
/**
*
*
* @exception SQLException if a database access error occurs
*/
private void writeProperties(WebRowSet caller) throws java.io.IOException {
beginSection("properties");
try {
propString("command", processSpecialCharacters(caller.getCommand()));
propInteger("concurrency", caller.getConcurrency());
propString("datasource", caller.getDataSourceName());
propBoolean("escape-processing",
caller.getEscapeProcessing());
try {
propInteger("fetch-direction", caller.getFetchDirection());
} catch(SQLException sqle) {
// it may be the case that fetch direction has not been set
// fetchDir == 0
// in that case it will throw a SQLException.
// To avoid that catch it here
}
propInteger("fetch-size", caller.getFetchSize());
propInteger("isolation-level",
caller.getTransactionIsolation());
beginSection("key-columns");
int[] kc = caller.getKeyColumns();
for (int i = 0; kc != null && i < kc.length; i++)
propInteger("column", kc[i]);
endSection("key-columns");
//Changed to beginSection and endSection for maps for proper indentation
beginSection("map");
Map<String, Class<?>> typeMap = caller.getTypeMap();
if(typeMap != null) {
for(Map.Entry<String, Class<?>> mm : typeMap.entrySet()) {
propString("type", mm.getKey());
propString("class", mm.getValue().getName());
}
}
endSection("map");
propInteger("max-field-size", caller.getMaxFieldSize());
propInteger("max-rows", caller.getMaxRows());
propInteger("query-timeout", caller.getQueryTimeout());
propBoolean("read-only", caller.isReadOnly());
int itype = caller.getType();
String strType = "";
if(itype == 1003) {
strType = "ResultSet.TYPE_FORWARD_ONLY";
} else if(itype == 1004) {
strType = "ResultSet.TYPE_SCROLL_INSENSITIVE";
} else if(itype == 1005) {
strType = "ResultSet.TYPE_SCROLL_SENSITIVE";
}
propString("rowset-type", strType);
propBoolean("show-deleted", caller.getShowDeleted());
propString("table-name", caller.getTableName());
propString("url", caller.getUrl());
beginSection("sync-provider");
// Remove the string after "@xxxx"
// before writing it to the xml file.
String strProviderInstance = (caller.getSyncProvider()).toString();
String strProvider = strProviderInstance.substring(0, (caller.getSyncProvider()).toString().indexOf('@'));
propString("sync-provider-name", strProvider);
propString("sync-provider-vendor", "Oracle Corporation");
propString("sync-provider-version", "1.0");
propInteger("sync-provider-grade", caller.getSyncProvider().getProviderGrade());
propInteger("data-source-lock", caller.getSyncProvider().getDataSourceLock());
endSection("sync-provider");
} catch (SQLException ex) {
throw new java.io.IOException(MessageFormat.format(resBundle.handleGetObject("wrsxmlwriter.sqlex").toString(), ex.getMessage()));
}
endSection("properties");
}
/**
*
*
* @exception SQLException if a database access error occurs
*/
private void writeMetaData(WebRowSet caller) throws java.io.IOException {
int columnCount;
beginSection("metadata");
try {
ResultSetMetaData rsmd = caller.getMetaData();
columnCount = rsmd.getColumnCount();
propInteger("column-count", columnCount);
for (int colIndex = 1; colIndex <= columnCount; colIndex++) {
beginSection("column-definition");
propInteger("column-index", colIndex);
propBoolean("auto-increment", rsmd.isAutoIncrement(colIndex));
propBoolean("case-sensitive", rsmd.isCaseSensitive(colIndex));
propBoolean("currency", rsmd.isCurrency(colIndex));
propInteger("nullable", rsmd.isNullable(colIndex));
propBoolean("signed", rsmd.isSigned(colIndex));
propBoolean("searchable", rsmd.isSearchable(colIndex));
propInteger("column-display-size",rsmd.getColumnDisplaySize(colIndex));
propString("column-label", rsmd.getColumnLabel(colIndex));
propString("column-name", rsmd.getColumnName(colIndex));
propString("schema-name", rsmd.getSchemaName(colIndex));
propInteger("column-precision", rsmd.getPrecision(colIndex));
propInteger("column-scale", rsmd.getScale(colIndex));
propString("table-name", rsmd.getTableName(colIndex));
propString("catalog-name", rsmd.getCatalogName(colIndex));
propInteger("column-type", rsmd.getColumnType(colIndex));
propString("column-type-name", rsmd.getColumnTypeName(colIndex));
endSection("column-definition");
}
} catch (SQLException ex) {
throw new java.io.IOException(MessageFormat.format(resBundle.handleGetObject("wrsxmlwriter.sqlex").toString(), ex.getMessage()));
}
endSection("metadata");
}
/**
*
*
* @exception SQLException if a database access error occurs
*/
private void writeData(WebRowSet caller) throws java.io.IOException {
ResultSet rs;
try {
ResultSetMetaData rsmd = caller.getMetaData();
int columnCount = rsmd.getColumnCount();
int i;
beginSection("data");
caller.beforeFirst();
caller.setShowDeleted(true);
while (caller.next()) {
if (caller.rowDeleted() && caller.rowInserted()) {
beginSection("modifyRow");
} else if (caller.rowDeleted()) {
beginSection("deleteRow");
} else if (caller.rowInserted()) {
beginSection("insertRow");
} else {
beginSection("currentRow");
}
for (i = 1; i <= columnCount; i++) {
if (caller.columnUpdated(i)) {
rs = caller.getOriginalRow();
rs.next();
beginTag("columnValue");
writeValue(i, (RowSet)rs);
endTag("columnValue");
beginTag("updateRow");
writeValue(i, caller);
endTag("updateRow");
} else {
beginTag("columnValue");
writeValue(i, caller);
endTag("columnValue");
}
}
endSection(); // this is unchecked
}
endSection("data");
} catch (SQLException ex) {
throw new java.io.IOException(MessageFormat.format(resBundle.handleGetObject("wrsxmlwriter.sqlex").toString(), ex.getMessage()));
}
}
private void writeValue(int idx, RowSet caller) throws java.io.IOException {
try {
int type = caller.getMetaData().getColumnType(idx);
switch (type) {
case java.sql.Types.BIT:
case java.sql.Types.BOOLEAN:
boolean b = caller.getBoolean(idx);
if (caller.wasNull())
writeNull();
else
writeBoolean(b);
break;
case java.sql.Types.TINYINT:
case java.sql.Types.SMALLINT:
short s = caller.getShort(idx);
if (caller.wasNull())
writeNull();
else
writeShort(s);
break;
case java.sql.Types.INTEGER:
int i = caller.getInt(idx);
if (caller.wasNull())
writeNull();
else
writeInteger(i);
break;
case java.sql.Types.BIGINT:
long l = caller.getLong(idx);
if (caller.wasNull())
writeNull();
else
writeLong(l);
break;
case java.sql.Types.REAL:
case java.sql.Types.FLOAT:
float f = caller.getFloat(idx);
if (caller.wasNull())
writeNull();
else
writeFloat(f);
break;
case java.sql.Types.DOUBLE:
double d = caller.getDouble(idx);
if (caller.wasNull())
writeNull();
else
writeDouble(d);
break;
case java.sql.Types.NUMERIC:
case java.sql.Types.DECIMAL:
writeBigDecimal(caller.getBigDecimal(idx));
break;
case java.sql.Types.BINARY:
case java.sql.Types.VARBINARY:
case java.sql.Types.LONGVARBINARY:
break;
case java.sql.Types.DATE:
java.sql.Date date = caller.getDate(idx);
if (caller.wasNull())
writeNull();
else
writeLong(date.getTime());
break;
case java.sql.Types.TIME:
java.sql.Time time = caller.getTime(idx);
if (caller.wasNull())
writeNull();
else
writeLong(time.getTime());
break;
case java.sql.Types.TIMESTAMP:
java.sql.Timestamp ts = caller.getTimestamp(idx);
if (caller.wasNull())
writeNull();
else
writeLong(ts.getTime());
break;
case java.sql.Types.CHAR:
case java.sql.Types.VARCHAR:
case java.sql.Types.LONGVARCHAR:
writeStringData(caller.getString(idx));
break;
default:
System.out.println(resBundle.handleGetObject("wsrxmlwriter.notproper").toString());
//Need to take care of BLOB, CLOB, Array, Ref here
}
} catch (SQLException ex) {
throw new java.io.IOException(resBundle.handleGetObject("wrsxmlwriter.failedwrite").toString()+ ex.getMessage());
}
}
/*
* This begins a new tag with a indent
*
*/
private void beginSection(String tag) throws java.io.IOException {
// store the current tag
setTag(tag);
writeIndent(stack.size());
// write it out
writer.write("<" + tag + ">\n");
}
/*
* This closes a tag started by beginTag with a indent
*
*/
private void endSection(String tag) throws java.io.IOException {
writeIndent(stack.size());
String beginTag = getTag();
if(beginTag.indexOf("webRowSet") != -1) {
beginTag ="webRowSet";
}
if (tag.equals(beginTag) ) {
// get the current tag and write it out
writer.write("</" + beginTag + ">\n");
} else {
;
}
writer.flush();
}
private void endSection() throws java.io.IOException {
writeIndent(stack.size());
// get the current tag and write it out
String beginTag = getTag();
writer.write("</" + beginTag + ">\n");
writer.flush();
}
private void beginTag(String tag) throws java.io.IOException {
// store the current tag
setTag(tag);
writeIndent(stack.size());
// write tag out
writer.write("<" + tag + ">");
}
private void endTag(String tag) throws java.io.IOException {
String beginTag = getTag();
if (tag.equals(beginTag)) {
// get the current tag and write it out
writer.write("</" + beginTag + ">\n");
} else {
;
}
writer.flush();
}
private void emptyTag(String tag) throws java.io.IOException {
// write an emptyTag
writer.write("<" + tag + "/>");
}
private void setTag(String tag) {
// add the tag to stack
stack.push(tag);
}
private String getTag() {
return stack.pop();
}
private void writeNull() throws java.io.IOException {
emptyTag("null");
}
private void writeStringData(String s) throws java.io.IOException {
if (s == null) {
writeNull();
} else if (s.equals("")) {
writeEmptyString();
} else {
s = processSpecialCharacters(s);
writer.write(s);
}
}
private void writeString(String s) throws java.io.IOException {
if (s != null) {
writer.write(s);
} else {
writeNull();
}
}
private void writeShort(short s) throws java.io.IOException {
writer.write(Short.toString(s));
}
private void writeLong(long l) throws java.io.IOException {
writer.write(Long.toString(l));
}
private void writeInteger(int i) throws java.io.IOException {
writer.write(Integer.toString(i));
}
private void writeBoolean(boolean b) throws java.io.IOException {
writer.write(Boolean.valueOf(b).toString());
}
private void writeFloat(float f) throws java.io.IOException {
writer.write(Float.toString(f));
}
private void writeDouble(double d) throws java.io.IOException {
writer.write(Double.toString(d));
}
private void writeBigDecimal(java.math.BigDecimal bd) throws java.io.IOException {
if (bd != null)
writer.write(bd.toString());
else
emptyTag("null");
}
private void writeIndent(int tabs) throws java.io.IOException {
// indent...
for (int i = 1; i < tabs; i++) {
writer.write(" ");
}
}
private void propString(String tag, String s) throws java.io.IOException {
beginTag(tag);
writeString(s);
endTag(tag);
}
private void propInteger(String tag, int i) throws java.io.IOException {
beginTag(tag);
writeInteger(i);
endTag(tag);
}
private void propBoolean(String tag, boolean b) throws java.io.IOException {
beginTag(tag);
writeBoolean(b);
endTag(tag);
}
private void writeEmptyString() throws java.io.IOException {
emptyTag("emptyString");
}
/**
* Purely for code coverage purposes..
*/
public boolean writeData(RowSetInternal caller) {
return false;
}
/**
* This function has been added for the processing of special characters
* lik <,>,'," and & in the data to be serialized. These have to be taken
* of specifically or else there will be parsing error while trying to read
* the contents of the XML file.
**/
private String processSpecialCharacters(String s) {
if(s == null) {
return null;
}
char []charStr = s.toCharArray();
String specialStr = "";
for(int i = 0; i < charStr.length; i++) {
if(charStr[i] == '&') {
specialStr = specialStr.concat("&amp;");
} else if(charStr[i] == '<') {
specialStr = specialStr.concat("&lt;");
} else if(charStr[i] == '>') {
specialStr = specialStr.concat("&gt;");
} else if(charStr[i] == '\'') {
specialStr = specialStr.concat("&apos;");
} else if(charStr[i] == '\"') {
specialStr = specialStr.concat("&quot;");
} else {
specialStr = specialStr.concat(String.valueOf(charStr[i]));
}
}
s = specialStr;
return s;
}
/**
* This method re populates the resBundle
* during the deserialization process
*
*/
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
// Default state initialization happens here
ois.defaultReadObject();
// Initialization of transient Res Bundle happens here .
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
static final long serialVersionUID = 7163134986189677641L;
}

View file

@ -0,0 +1,59 @@
/*
* Copyright (c) 2003, 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.internal;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
import com.sun.rowset.*;
import javax.sql.rowset.*;
/**
* An implementation of the <code>DefaultHandler</code> interface, which
* handles all the errors, fatalerrors and warnings while reading the xml file.
* This is the ErrorHandler which helps <code>WebRowSetXmlReader</code>
* to handle any errors while reading the xml data.
*/
public class XmlErrorHandler extends DefaultHandler {
public int errorCounter = 0;
public void error(SAXParseException e) throws SAXException {
errorCounter++;
}
public void fatalError(SAXParseException e) throws SAXException {
errorCounter++;
}
public void warning(SAXParseException exception) throws SAXException {
}
}

View file

@ -0,0 +1,56 @@
/*
* Copyright (c) 2003, 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.internal;
import org.xml.sax.*;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
/**
* An implementation of the <code>EntityResolver</code> interface, which
* reads and parses an XML formatted <code>WebRowSet</code> object.
* This is an implementation of org.xml.sax
*
*/
public class XmlResolver implements EntityResolver {
public InputSource resolveEntity(String publicId, String systemId) {
String schemaName = systemId.substring(systemId.lastIndexOf('/'));
if(systemId.startsWith("http://java.sun.com/xml/ns/jdbc")) {
return new InputSource(this.getClass().getResourceAsStream(schemaName));
} else {
// use the default behaviour
return null;
}
}
}

View file

@ -0,0 +1,86 @@
<!--
Copyright (c) 2003, 2013, 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.
-->
<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>com.sun.rowset Package</title>
</head>
<body bgcolor="#ffffff">
Provides five standard implementations of the standard JDBC <code>RowSet</code> implementation
interface definitions. These reference implementations are included with the J2SE version
1.5 platform and represent the benchmark standard <code>RowSet</code> implementations as verified
by the Test Compatibility Kit (TCK) as mandated by the Java Community Process.
<br>
<h3>1.0 Available JDBC RowSet Reference Implementations </h3>
The following implementations are provided:<br>
<blockquote><code><b>JdbcRowSetImpl</b></code> - The <code>javax.sql.rowset.JdbcRowSet</code>
interface reference implementation. <br>
<br>
<code><b>CachedRowSetImpl</b></code> - The <code>javax.sql.rowset.CachedRowSet</code> interface
reference implementation.<br>
<br>
<code><b>WebRowSetImpl</b></code> - The <code>javax.sql.rowset.WebRowSet</code> interface
reference implementation.<br>
<br>
<code><b>FilteredRowSetImpl</b></code> - The <code>javax.sql.rowset.FilteredRowSet</code>
interface reference implementation.<br>
<br>
<code><b>JoinRowSetImpl</b></code> - The <code>javax.sql.rowset.JoinRowSet</code> interface
reference implementation.<br>
</blockquote>
All details on their expected behavior, including their interactions with the <code>SyncProvider</code>
SPI and helper classes are provided in the interface definitions in the <code>javax.sql.rowset</code>
package specification.<br>
<h3>2.0 Usage</h3>
The reference implementations represent robust implementations of the standard
<code>RowSet</code> interfaces defined in the <code>javax.sql.rowset</code> package.
All disconnected <code>RowSet</code> implementations, such as the <code>CachedRowSetImpl</code>
and <code>WebRowSetImpl</code>, are flexible enough to use the <code>SyncFactory</code> SPIs to
leverage non-reference implementation <code>SyncProvider</code> implementations to obtain
differing synchronization semantics. Furthermore, developers and vendors alike are free
to use these implementations and integrate them into their products just as they
can with to other components of the Java platform.<br>
<h3>3.0 Extending the JDBC RowSet Implementations</h3>
The JDBC <code>RowSet</code> reference implementations are provided as non-final
classes so that any developer can extend them to provide additional features
while maintaining the core required standard functionality and compatibility. It
is anticipated that many vendors and developers will extend the standard feature
set to their their particular needs. The website for JDBC Technology will
provider a portal where implementations can be listed, similar to the way it
provides a site for JDBC drivers.
<br>
<br>
</body>
</html>

View file

@ -0,0 +1,262 @@
/*
* 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
* 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.providers;
import com.sun.rowset.JdbcRowSetResourceBundle;
import javax.sql.*;
import java.io.*;
import javax.sql.rowset.spi.*;
import com.sun.rowset.internal.*;
/**
* The reference implementation of a JDBC Rowset synchronization provider
* providing optimistic synchronization with a relational datastore
* using any JDBC technology-enabled driver.
*
* <h3>1.0 Backgroud</h3>
* This synchronization provider is registered with the
* <code>SyncFactory</code> by default as the
* <code>com.sun.rowset.providers.RIOptimisticProvider</code>.
* As an extension of the <code>SyncProvider</code> abstract
* class, it provides the reader and writer classes required by disconnected
* rowsets as <code>javax.sql.RowSetReader</code> and <code>javax.sql.RowSetWriter</code>
* interface implementations. As a reference implementation,
* <code>RIOptimisticProvider</code> provides a
* fully functional implementation offering a medium grade classification of
* syncrhonization, namely GRADE_CHECK_MODIFIED_AT_COMMIT. A
* disconnected <code>RowSet</code> implementation using the
* <code>RIOptimisticProvider</code> can expect the writer to
* check only rows that have been modified in the <code>RowSet</code> against
* the values in the data source. If there is a conflict, that is, if a value
* in the data source has been changed by another party, the
* <code>RIOptimisticProvider</code> will not write any of the changes to the data
* source and will throw a <code>SyncProviderException</code> object.
*
* <h3>2.0 Usage</h3>
* Standard disconnected <code>RowSet</code> implementations may opt to use this
* <code>SyncProvider</code> implementation in one of two ways:
* <OL>
* <LI>By specifically calling the <code>setSyncProvider</code> method
defined in the <code>CachedRowSet</code> interface
* <pre>
* CachedRowset crs = new FooCachedRowSetImpl();
* crs.setSyncProvider("com.sun.rowset.providers.RIOptimisticProvider");
* </pre>
* <LI>By specifying it in the constructor of the <code>RowSet</code>
* implementation
* <pre>
* CachedRowset crs = new FooCachedRowSetImpl(
* "com.sun.rowset.providers.RIOptimisticProvider");
* </pre>
* </OL>
* Note that because the <code>RIOptimisticProvider</code> implementation is
* the default provider, it will always be the provider when no provider ID is
* specified to the constructor.
* <P>
* See the standard <code>RowSet</code> reference implementations in the
* <code>com.sun.rowset</code> package for more details.
*
* @author Jonathan Bruce
* @see javax.sql.rowset.spi.SyncProvider
* @see javax.sql.rowset.spi.SyncProviderException
* @see javax.sql.rowset.spi.SyncFactory
* @see javax.sql.rowset.spi.SyncFactoryException
*
*/
public final class RIOptimisticProvider extends SyncProvider implements Serializable {
private CachedRowSetReader reader;
private CachedRowSetWriter writer;
/**
* The unique provider identifier.
*/
private String providerID = "com.sun.rowset.providers.RIOptimisticProvider";
/**
* The vendor name of this SyncProvider implementation
*/
private String vendorName = "Oracle Corporation";
/**
* The version number of this SyncProvider implementation
*/
private String versionNumber = "1.0";
/**
* ResourceBundle
*/
private JdbcRowSetResourceBundle resBundle;
/**
* Creates an <code>RIOptimisticProvider</code> object initialized with the
* fully qualified class name of this <code>SyncProvider</code> implementation
* and a default reader and writer.
* <P>
* This provider is available to all disconnected <code>RowSet</code> implementations
* as the default persistence provider.
*/
public RIOptimisticProvider() {
providerID = this.getClass().getName();
reader = new CachedRowSetReader();
writer = new CachedRowSetWriter();
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
/**
* Returns the <code>'javax.sql.rowset.providers.RIOptimisticProvider'</code>
* provider identification string.
*
* @return String Provider ID of this persistence provider
*/
public String getProviderID() {
return providerID;
}
/**
* Returns the <code>javax.sql.RowSetWriter</code> object for this
* <code>RIOptimisticProvider</code> object. This is the writer that will
* write changes made to the <code>Rowset</code> object back to the data source.
*
* @return the <code>javax.sql.RowSetWriter</code> object for this
* <code>RIOptimisticProvider</code> object
*/
public RowSetWriter getRowSetWriter() {
try {
writer.setReader(reader);
} catch (java.sql.SQLException e) {}
return writer;
}
/**
* Returns the <code>javax.sql.RowSetReader</code> object for this
* <code>RIOptimisticProvider</code> object. This is the reader that will
* populate a <code>RowSet</code> object using this <code>RIOptimisticProvider</code>.
*
* @return the <code>javax.sql.RowSetReader</code> object for this
* <code>RIOptimisticProvider</code> object
*/
public RowSetReader getRowSetReader() {
return reader;
}
/**
* Returns the <code>SyncProvider</code> grade of synchronization that
* <code>RowSet</code> objects can expect when using this
* implementation. As an optimisic synchonization provider, the writer
* will only check rows that have been modified in the <code>RowSet</code>
* object.
*/
public int getProviderGrade() {
return SyncProvider.GRADE_CHECK_MODIFIED_AT_COMMIT;
}
/**
* Modifies the data source lock severity according to the standard
* <code>SyncProvider</code> classifications.
*
* @param datasource_lock An <code>int</code> indicating the level of locking to be
* set; must be one of the following constants:
* <PRE>
* SyncProvider.DATASOURCE_NO_LOCK,
* SyncProvider.DATASOURCE_ROW_LOCK,
* SyncProvider.DATASOURCE_TABLE_LOCK,
* SyncProvider.DATASOURCE_DB_LOCk
* </PRE>
* @throws SyncProviderException if the parameter specified is not
* <code>SyncProvider.DATASOURCE_NO_LOCK</code>
*/
public void setDataSourceLock(int datasource_lock) throws SyncProviderException {
if(datasource_lock != SyncProvider.DATASOURCE_NO_LOCK ) {
throw new SyncProviderException(resBundle.handleGetObject("riop.locking").toString());
}
}
/**
* Returns the active data source lock severity in this
* reference implementation of the <code>SyncProvider</code>
* abstract class.
*
* @return <code>SyncProvider.DATASOURCE_NO_LOCK</code>.
* The reference implementation does not support data source locks.
*/
public int getDataSourceLock() throws SyncProviderException {
return SyncProvider.DATASOURCE_NO_LOCK;
}
/**
* Returns the supported updatable view abilities of the
* reference implementation of the <code>SyncProvider</code>
* abstract class.
*
* @return <code>SyncProvider.NONUPDATABLE_VIEW_SYNC</code>. The
* the reference implementation does not support updating tables
* that are the source of a view.
*/
public int supportsUpdatableView() {
return SyncProvider.NONUPDATABLE_VIEW_SYNC;
}
/**
* Returns the release version ID of the Reference Implementation Optimistic
* Synchronization Provider.
*
* @return the <code>String</code> detailing the version number of this SyncProvider
*/
public String getVersion() {
return this.versionNumber;
}
/**
* Returns the vendor name of the Reference Implementation Optimistic
* Synchronization Provider
*
* @return the <code>String</code> detailing the vendor name of this
* SyncProvider
*/
public String getVendor() {
return this.vendorName;
}
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
// Default state initialization happens here
ois.defaultReadObject();
// Initialization of transient Res Bundle happens here .
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
static final long serialVersionUID =-3143367176751761936L;
}

View file

@ -0,0 +1,248 @@
/*
* 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
* 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.providers;
import com.sun.rowset.JdbcRowSetResourceBundle;
import java.io.IOException;
import java.sql.*;
import javax.sql.*;
import javax.sql.rowset.spi.*;
/**
* A reference implementation of a JDBC RowSet synchronization provider
* with the ability to read and write rowsets in well formed XML using the
* standard WebRowSet schema.
*
* <h3>1.0 Background</h3>
* This synchronization provider is registered with the
* <code>SyncFactory</code> by default as the
* <code>com.sun.rowset.providers.RIXMLProvider</code>.
* <P>
* A <code>WebRowSet</code> object uses an <code>RIXMLProvider</code> implementation
* to read an XML data source or to write itself in XML format using the
* <code>WebRowSet</code> XML schema definition available at
* <pre>
* <a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">http://java.sun.com/xml/ns/jdbc/webrowset.xsd</a>
* </pre>
* The <code>RIXMLProvider</code> implementation has a synchronization level of
* GRADE_NONE, which means that it does no checking at all for conflicts. It
* simply writes a <code>WebRowSet</code> object to a file.
* <h3>2.0 Usage</h3>
* A <code>WebRowSet</code> implementation is created with an <code>RIXMLProvider</code>
* by default.
* <pre>
* WebRowSet wrs = new FooWebRowSetImpl();
* </pre>
* The <code>SyncFactory</code> always provides an instance of
* <code>RIOptimisticProvider</code> when no provider is specified,
* but the implementation of the default constructor for <code>WebRowSet</code> sets the
* provider to be the <code>RIXMLProvider</code> implementation. Therefore,
* the following line of code is executed behind the scenes as part of the
* implementation of the default constructor.
* <pre>
* wrs.setSyncProvider("com.sun.rowset.providers.RIXMLProvider");
* </pre>
* See the standard <code>RowSet</code> reference implementations in the
* <code>com.sun.rowset</code> package for more details.
*
* @author Jonathan Bruce
* @see javax.sql.rowset.spi.SyncProvider
* @see javax.sql.rowset.spi.SyncProviderException
* @see javax.sql.rowset.spi.SyncFactory
* @see javax.sql.rowset.spi.SyncFactoryException
*/
public final class RIXMLProvider extends SyncProvider {
/**
* The unique provider identifier.
*/
private String providerID = "com.sun.rowset.providers.RIXMLProvider";
/**
* The vendor name of this SyncProvider implementation.
*/
private String vendorName = "Oracle Corporation";
/**
* The version number of this SyncProvider implementation.
*/
private String versionNumber = "1.0";
private JdbcRowSetResourceBundle resBundle;
private XmlReader xmlReader;
private XmlWriter xmlWriter;
/**
* This provider is available to all JDBC <code>RowSet</code> implementations as the
* default persistence provider.
*/
public RIXMLProvider() {
providerID = this.getClass().getName();
try {
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
} catch(IOException ioe) {
throw new RuntimeException(ioe);
}
}
/**
* Returns <code>"javax.sql.rowset.providers.RIXMLProvider"</code>, which is
* the fully qualified class name of this provider implementation.
*
* @return a <code>String</code> object with the fully specified class name of
* this <code>RIOptimisticProvider</code> implementation
*/
public String getProviderID() {
return providerID;
}
// additional methods that sit on top of reader/writer methods back to
// original datasource. Allow XML state to be written out and in
/**
* Sets this <code>WebRowSet</code> object's reader to the given
* <code>XmlReader</code> object.
*
* @throws SQLException if a database access error occurs
*/
public void setXmlReader(XmlReader reader) throws SQLException {
xmlReader = reader;
}
/**
* Sets this <code>WebRowSet</code> object's writer to the given
* <code>XmlWriter</code> object.
*
* @throws SQLException if a database access error occurs
*/
public void setXmlWriter(XmlWriter writer) throws SQLException {
xmlWriter = writer;
}
/**
* Retrieves the reader that this <code>WebRowSet</code> object
* will call when its <code>readXml</code> method is called.
*
* @return the <code>XmlReader</code> object for this SyncProvider
* @throws SQLException if a database access error occurs
*/
public XmlReader getXmlReader() throws SQLException {
return xmlReader;
}
/**
* Retrieves the writer that this <code>WebRowSet</code> object
* will call when its <code>writeXml</code> method is called.
*
* @return the <code>XmlWriter</code> for this SyncProvider
* @throws SQLException if a database access error occurs
*/
public XmlWriter getXmlWriter() throws SQLException {
return xmlWriter;
}
/**
* Returns the <code>SyncProvider</code> grade of syncrhonization that
* <code>RowSet</code> object instances can expect when using this
* implementation. As this implementation provides no synchonization
* facilities to the XML data source, the lowest grade is returned.
*
* @return the <code>SyncProvider</code> syncronization grade of this
* provider; must be one of the following constants:
* <PRE>
* SyncProvider.GRADE_NONE,
* SyncProvider.GRADE_MODIFIED_AT_COMMIT,
* SyncProvider.GRADE_CHECK_ALL_AT_COMMIT,
* SyncProvider.GRADE_LOCK_WHEN_MODIFIED,
* SyncProvider.GRADE_LOCK_WHEN_LOADED
* </PRE>
*
*/
public int getProviderGrade() {
return SyncProvider.GRADE_NONE;
}
/**
* Returns the default UPDATABLE_VIEW behavior of this reader
*
*/
public int supportsUpdatableView() {
return SyncProvider.NONUPDATABLE_VIEW_SYNC;
}
/**
* Returns the default DATASOURCE_LOCK behavior of this reader
*/
public int getDataSourceLock() throws SyncProviderException {
return SyncProvider.DATASOURCE_NO_LOCK;
}
/**
* Throws an unsupported operation exception as this method does
* function with non-locking XML data sources.
*/
public void setDataSourceLock(int lock) throws SyncProviderException {
throw new UnsupportedOperationException(resBundle.handleGetObject("rixml.unsupp").toString());
}
/**
* Returns a null object as RowSetWriters are not returned by this SyncProvider
*/
public RowSetWriter getRowSetWriter() {
return null;
}
/**
* Returns a null object as RowSetWriter objects are not returned by this
* SyncProvider
*/
public RowSetReader getRowSetReader() {
return null;
}
/**
* Returns the release version ID of the Reference Implementation Optimistic
* Synchronization Provider.
*
* @return the <code>String</code> detailing the version number of this SyncProvider
*/
public String getVersion() {
return this.versionNumber;
}
/**
* Returns the vendor name of the Reference Implemntation Optimistic
* Syncchronication Provider
*
* @return the <code>String</code> detailing the vendor name of this
* SyncProvider
*/
public String getVendor() {
return this.vendorName;
}
}

View file

@ -0,0 +1,170 @@
<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR"
content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]">
<!--
Copyright (c) 2003, 2006, 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.
-->
<title>javax.sql.rowset.providers Package</title>
</head>
<body bgcolor="#ffffff">
Repository for the <code>RowSet</code> reference implementations of the
<code>SyncProvider</code> abstract class. These implementations provide a
disconnected <code>RowSet</code>
object with the ability to synchronize the data in the underlying data
source with its data. These implementations are provided as
the default <code>SyncProvider</code> implementations and are accessible via the
<code>SyncProvider</code> SPI managed by the <code>SyncFactory</code>.
<h3>1.0 <code>SyncProvider</code> Reference Implementations</h3>
The main job of a <code>SyncProvider</code> implementation is to manage
the reader and writer mechanisms.
The <code>SyncProvider</code> SPI, as specified in the <code>javax.sql.rowset.spi</code>
package, provides a pluggable mechanism by which <code>javax.sql.RowSetReader</code>
and <code>javax.sql.RowSetWriter</code> implementations can be supplied to a disconnected
<code>RowSet</code> object.
<P>
A reader, a <code>javax.sql.RowSetReader</code>
object, does the work necessary to populate a <code>RowSet</code> object with data.
A writer, a <code>javax.sql.RowSetWriter</code> object, does the work necessary for
synchronizing a <code>RowSet</code> object's data with the data in the originating
source of data. Put another way, a writer writes a <code>RowSet</code>
object's data back to the data source.
<P>
Generally speaking, the course of events is this. The reader makes a connection to
the data source and reads the data from a <code>ResultSet</code> object into its
<code>RowSet</code> object. Then it closes the connection. While
the <code>RowSet</code> object is disconnected, an application makes some modifications
to the data and calls the method <code>acceptChanges</code>. At this point, the
writer is called to write the changes back to the database table or view
from which the original data came. This is called <i>synchronization</i>.
<P>
If the data in the originating data source has not changed, there is no problem
with just writing the <code>RowSet</code> object's new data to the data source.
If it has changed, however, there is a conflict that needs to be resolved. One
way to solve the problem is not to let the data in the data source be changed in
the first place, which can be done by setting locks on a row, a table, or the
whole data source. Setting locks is a way to avoid conflicts, but it can be
very expensive. Another approach, which is at the other end of the spectrum,
is simply to assume that no conflicts will occur and thus do nothing to avoid
conflicts.
Different <code>SyncProvider</code> implementations may handle synchronization in
any of these ways, varying from doing no checking for
conflicts, to doing various levels of checking, to guaranteeing that there are no
conflicts.
<P>
The <code>SyncProvider</code> class offers methods to help a <code>RowSet</code>
object discover and manage how a provider handles synchronization.
The method <code>getProviderGrade</code> returns the
grade of synchronization a provider offers. An application can
direct the provider to use a particular level of locking by calling
the method <code>setDataSourceLock</code> and specifying the level of locking desired.
If a <code>RowSet</code> object's data came from an SQL <code>VIEW</code>, an
application may call the method <code>supportsUpdatableView</code> to
find out whether the <code>VIEW</code> can be updated.
<P>
Synchronization is done completely behind the scenes, so it is third party vendors of
synchronization provider implementations who have to take care of this complex task.
Application programmers can decide which provider to use and the level of locking to
be done, but they are free from having to worry about the implementation details.
<P>
The JDBC <code>RowSet</code> Implementations reference implementation provides two
implementations of the <code>SyncProvider</code> class:
<UL>
<LI>
<b><code>RIOptimisticProvider</code></b> - provides the <code>javax.sql.RowSetReader</code>
and <code>javax.sql.RowSetWriter</code> interface implementations and provides
an optimistic concurrency model for synchronization. This model assumes that there
will be few conflicts and therefore uses a relatively low grade of synchronization.
If no other provider is available, this is the default provider that the
<code>SyncFactory</code> will supply to a <code>RowSet</code> object.
<br>
<LI>
<b><code>RIXMLProvider</code></b> - provides the <code>XmlReader</code> (an extension
of the <code>javax.sql.RowSetReader</code> interface) and the <code>XmlWriter</code>
(an extension of the <code>javax.sql.RowSetWriter</code> interface) to enable
<code>WebRowSet</code> objects to write their state to a
well formed XML document according to the <code>WebRowSet</code> XML schema
definition.<br>
</UL>
<h3>2.0 Basics in RowSet Population &amp; Synchronization</h3>
A rowset's first task is to populate itself with rows of column values.
Generally, these rows will come from a relational database, so a rowset
has properties that supply what is necessary for making a connection to
a database and executing a query. A rowset that does not need to establish
a connection and execute a command, such as one that gets its data from
a tabular file instead of a relational database, does not need to have these
properties set. The vast majority of RowSets, however, do need to set these
properties. The general rule is that a RowSet is required to set only the
properties that it uses.<br>
<br>
The <code>command</code> property contains the query that determines what
data a <code>RowSet</code> will contain. Rowsets have methods for setting a query's
parameter(s), which means that a query can be executed multiple times with
different parameters to produce different result sets. Or the query can be
changed to something completely new to get a new result set.
<p>Once a rowset contains the rows from a <code>ResultSet</code> object or some
other data source, its column values can be updated, and its rows can be
inserted or deleted. Any method that causes a change in the rowset's values
or cursor position also notifies any object that has been registered as
a listener with the rowset. So, for example, a table that displays the rowset's
data in an applet can be notified of changes and make updates as they
occur.<br>
<br>
The changes made to a rowset can be propagated back to the original data
source to keep the rowset and its data source synchronized. Although this
involves many operations behind the scenes, it is completely transparent
to the application programmer and remains the concern of the RowSet provider
developer. All an application has to do is invoke the method <code>acceptChanges</code>,
and the data source backing the rowset will be updated to match the current
values in the rowset. </p>
<p>A disconnected rowset, such as a <code>CachedRowSet</code> or <code>WebRowSet</code>
object, establishes a connection to populate itself with data from a database
and then closes the connection. The <code>RowSet</code> object will remain
disconnected until it wants to propagate changes back to its database table,
which is optional. To write its changes back to the database (synchronize with
the database), the rowset establishes a connection, write the changes, and then
once again disconnects itself.<br>
</p>
<h3> 3.0 Other Possible Implementations</h3>
There are many other possible implementations of the <code>SyncProvider</code> abstract
class. One possibility is to employ a more robust synchronization model, which
would give a <code>RowSet</code> object increased trust in the provider's
ability to get any updates back to the original data source. Another possibility
is a more formal synchronization mechanism such as SyncML
(<a href="http://www.syncml.org/">http://www.syncml.org/</a>) <br>
<br>
<br>
</body>
</html>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,161 @@
/*
* Copyright (c) 2003, 2013, 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.*;
import javax.sql.*;
import javax.naming.*;
import java.io.*;
import java.math.*;
/**
* The standard interface that all standard implementations of
* <code>FilteredRowSet</code> must implement. The <code>FilteredRowSetImpl</code> class
* provides the reference implementation which may be extended if required.
* Alternatively, a vendor is free to implement its own version
* by implementing this interface.
*
* <h3>1.0 Background</h3>
*
* There are occasions when a <code>RowSet</code> object has a need to provide a degree
* of filtering to its contents. One possible solution is to provide
* a query language for all standard <code>RowSet</code> implementations; however,
* this is an impractical approach for lightweight components such as disconnected
* <code>RowSet</code>
* objects. The <code>FilteredRowSet</code> interface seeks to address this need
* without supplying a heavyweight query language along with the processing that
* such a query language would require.
* <p>
* A JDBC <code>FilteredRowSet</code> standard implementation implements the
* <code>RowSet</code> interfaces and extends the
* <code>CachedRowSet</code>&trade; class. The
* <code>CachedRowSet</code> class provides a set of protected cursor manipulation
* methods, which a <code>FilteredRowSet</code> implementation can override
* to supply filtering support.
*
* <h3>2.0 Predicate Sharing</h3>
*
* If a <code>FilteredRowSet</code> implementation is shared using the
* inherited <code>createShared</code> method in parent interfaces, the
* <code>Predicate</code> should be shared without modification by all
* <code>FilteredRowSet</code> instance clones.
*
* <h3>3.0 Usage</h3>
* <p>
* By implementing a <code>Predicate</code> (see example in <a href="Predicate.html">Predicate</a>
* class JavaDoc), a <code>FilteredRowSet</code> could then be used as described
* below.
*
* <pre>
* {@code
* FilteredRowSet frs = new FilteredRowSetImpl();
* frs.populate(rs);
*
* Range name = new Range("Alpha", "Bravo", "columnName");
* frs.setFilter(name);
*
* frs.next() // only names from "Alpha" to "Bravo" will be returned
* }
* </pre>
* In the example above, we initialize a <code>Range</code> object which
* implements the <code>Predicate</code> interface. This object expresses
* the following constraints: All rows outputted or modified from this
* <code>FilteredRowSet</code> object must fall between the values 'Alpha' and
* 'Bravo' both values inclusive, in the column 'columnName'. If a filter is
* applied to a <code>FilteredRowSet</code> object that contains no data that
* falls within the range of the filter, no rows are returned.
* <p>
* This framework allows multiple classes implementing predicates to be
* used in combination to achieved the required filtering result with
* out the need for query language processing.
*
* <h3>4.0 Updating a <code>FilteredRowSet</code> Object</h3>
* The predicate set on a <code>FilteredRowSet</code> object
* applies a criterion on all rows in a
* <code>RowSet</code> object to manage a subset of rows in a <code>RowSet</code>
* object. This criterion governs the subset of rows that are visible and also
* defines which rows can be modified, deleted or inserted.
* <p>
* Therefore, the predicate set on a <code>FilteredRowSet</code> object must be
* considered as bi-directional and the set criterion as the gating mechanism
* for all views and updates to the <code>FilteredRowSet</code> object. Any attempt
* to update the <code>FilteredRowSet</code> that violates the criterion will
* result in a <code>SQLException</code> object being thrown.
* <p>
* The <code>FilteredRowSet</code> range criterion can be modified by applying
* a new <code>Predicate</code> object to the <code>FilteredRowSet</code>
* instance at any time. This is possible if no additional references to the
* <code>FilteredRowSet</code> object are detected. A new filter has an
* immediate effect on criterion enforcement within the
* <code>FilteredRowSet</code> object, and all subsequent views and updates will be
* subject to similar enforcement.
*
* <h3>5.0 Behavior of Rows Outside the Filter</h3>
* Rows that fall outside of the filter set on a <code>FilteredRowSet</code>
* object cannot be modified until the filter is removed or a
* new filter is applied.
* <p>
* Furthermore, only rows that fall within the bounds of a filter will be
* synchronized with the data source.
*
* @author Jonathan Bruce
* @since 1.5
*/
public interface FilteredRowSet extends WebRowSet {
/**
* Applies the given <code>Predicate</code> object to this
* <code>FilteredRowSet</code>
* object. The filter applies controls both to inbound and outbound views,
* constraining which rows are visible and which
* rows can be manipulated.
* <p>
* A new <code>Predicate</code> object may be set at any time. This has the
* effect of changing constraints on the <code>RowSet</code> object's data.
* In addition, modifying the filter at runtime presents issues whereby
* multiple components may be operating on one <code>FilteredRowSet</code> object.
* Application developers must take responsibility for managing multiple handles
* to <code>FilteredRowSet</code> objects when their underling <code>Predicate</code>
* objects change.
*
* @param p a <code>Predicate</code> object defining the filter for this
* <code>FilteredRowSet</code> object. Setting a <b>null</b> value
* will clear the predicate, allowing all rows to become visible.
*
* @throws SQLException if an error occurs when setting the
* <code>Predicate</code> object
*/
public void setFilter(Predicate p) throws SQLException;
/**
* Retrieves the active filter for this <code>FilteredRowSet</code> object.
*
* @return p the <code>Predicate</code> for this <code>FilteredRowSet</code>
* object; <code>null</code> if no filter has been set.
*/
public Predicate getFilter() ;
}

View file

@ -0,0 +1,289 @@
/*
* Copyright (c) 2003, 2014, 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.*;
import javax.sql.*;
import javax.naming.*;
import java.io.*;
import java.math.*;
import java.io.*;
/**
* The standard interface that all standard implementations of
* <code>JdbcRowSet</code> must implement.
*
* <h3>1.0 Overview</h3>
* A wrapper around a <code>ResultSet</code> object that makes it possible
* to use the result set as a JavaBeans&trade;
* component. Thus, a <code>JdbcRowSet</code> object can be one of the Beans that
* a tool makes available for composing an application. Because
* a <code>JdbcRowSet</code> is a connected rowset, that is, it continually
* maintains its connection to a database using a JDBC technology-enabled
* driver, it also effectively makes the driver a JavaBeans component.
* <P>
* Because it is always connected to its database, an instance of
* <code>JdbcRowSet</code>
* can simply take calls invoked on it and in turn call them on its
* <code>ResultSet</code> object. As a consequence, a result set can, for
* example, be a component in a Swing application.
* <P>
* Another advantage of a <code>JdbcRowSet</code> object is that it can be
* used to make a <code>ResultSet</code> object scrollable and updatable. All
* <code>RowSet</code> objects are by default scrollable and updatable. If
* the driver and database being used do not support scrolling and/or updating
* of result sets, an application can populate a <code>JdbcRowSet</code> object
* with the data of a <code>ResultSet</code> object and then operate on the
* <code>JdbcRowSet</code> object as if it were the <code>ResultSet</code>
* object.
*
* <h3>2.0 Creating a <code>JdbcRowSet</code> Object</h3>
* The reference implementation of the <code>JdbcRowSet</code> interface,
* <code>JdbcRowSetImpl</code>, provides an implementation of
* the default constructor. A new instance is initialized with
* default values, which can be set with new values as needed. A
* new instance is not really functional until its <code>execute</code>
* method is called. In general, this method does the following:
* <UL>
* <LI> establishes a connection with a database
* <LI> creates a <code>PreparedStatement</code> object and sets any of its
* placeholder parameters
* <LI> executes the statement to create a <code>ResultSet</code> object
* </UL>
* If the <code>execute</code> method is successful, it will set the
* appropriate private <code>JdbcRowSet</code> fields with the following:
* <UL>
* <LI> a <code>Connection</code> object -- the connection between the rowset
* and the database
* <LI> a <code>PreparedStatement</code> object -- the query that produces
* the result set
* <LI> a <code>ResultSet</code> object -- the result set that the rowset's
* command produced and that is being made, in effect, a JavaBeans
* component
* </UL>
* If these fields have not been set, meaning that the <code>execute</code>
* method has not executed successfully, no methods other than
* <code>execute</code> and <code>close</code> may be called on the
* rowset. All other public methods will throw an exception.
* <P>
* Before calling the <code>execute</code> method, however, the command
* and properties needed for establishing a connection must be set.
* The following code fragment creates a <code>JdbcRowSetImpl</code> object,
* sets the command and connection properties, sets the placeholder parameter,
* and then invokes the method <code>execute</code>.
* <PRE>
* JdbcRowSetImpl jrs = new JdbcRowSetImpl();
* jrs.setCommand("SELECT * FROM TITLES WHERE TYPE = ?");
* jrs.setURL("jdbc:myDriver:myAttribute");
* jrs.setUsername("cervantes");
* jrs.setPassword("sancho");
* jrs.setString(1, "BIOGRAPHY");
* jrs.execute();
* </PRE>
* The variable <code>jrs</code> now represents an instance of
* <code>JdbcRowSetImpl</code> that is a thin wrapper around the
* <code>ResultSet</code> object containing all the rows in the
* table <code>TITLES</code> where the type of book is biography.
* At this point, operations called on <code>jrs</code> will
* affect the rows in the result set, which is effectively a JavaBeans
* component.
* <P>
* The implementation of the <code>RowSet</code> method <code>execute</code> in the
* <code>JdbcRowSet</code> reference implementation differs from that in the
* <code>CachedRowSet</code>&trade;
* reference implementation to account for the different
* requirements of connected and disconnected <code>RowSet</code> objects.
*
* @author Jonathan Bruce
* @since 1.5
*/
public interface JdbcRowSet extends RowSet, Joinable {
/**
* Retrieves a <code>boolean</code> indicating whether rows marked
* for deletion appear in the set of current rows. If <code>true</code> is
* returned, deleted rows are visible with the current rows. If
* <code>false</code> is returned, rows are not visible with the set of
* current rows. The default value is <code>false</code>.
* <P>
* Standard rowset implementations may choose to restrict this behavior
* for security considerations or for certain deployment
* scenarios. The visibility of deleted rows is implementation-defined
* and does not represent standard behavior.
* <P>
* Note: Allowing deleted rows to remain visible complicates the behavior
* of some standard JDBC <code>RowSet</code> implementations methods.
* However, most rowset users can simply ignore this extra detail because
* only very specialized applications will likely want to take advantage of
* this feature.
*
* @return <code>true</code> if deleted rows are visible;
* <code>false</code> otherwise
* @exception SQLException if a rowset implementation is unable to
* to determine whether rows marked for deletion remain visible
* @see #setShowDeleted
*/
public boolean getShowDeleted() throws SQLException;
/**
* Sets the property <code>showDeleted</code> to the given
* <code>boolean</code> value. This property determines whether
* rows marked for deletion continue to appear in the set of current rows.
* If the value is set to <code>true</code>, deleted rows are immediately
* visible with the set of current rows. If the value is set to
* <code>false</code>, the deleted rows are set as invisible with the
* current set of rows.
* <P>
* Standard rowset implementations may choose to restrict this behavior
* for security considerations or for certain deployment
* scenarios. This is left as implementation-defined and does not
* represent standard behavior.
*
* @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
* @see #getShowDeleted
*/
public void setShowDeleted(boolean b) throws SQLException;
/**
* Retrieves the first warning reported by calls on this <code>JdbcRowSet</code>
* object.
* If a second warning was reported on this <code>JdbcRowSet</code> object,
* it will be chained to the first warning and can be retrieved by
* calling the method <code>RowSetWarning.getNextWarning</code> on the
* first warning. Subsequent warnings on this <code>JdbcRowSet</code>
* object will be chained to the <code>RowSetWarning</code> objects
* returned by the method <code>RowSetWarning.getNextWarning</code>.
*
* The warning chain is automatically cleared each time a new row is read.
* This method may not be called on a <code>RowSet</code> object
* that has been closed;
* doing so will cause an <code>SQLException</code> to be thrown.
* <P>
* Because it is always connected to its data source, a <code>JdbcRowSet</code>
* object can rely on the presence of active
* <code>Statement</code>, <code>Connection</code>, and <code>ResultSet</code>
* instances. This means that applications can obtain additional
* <code>SQLWarning</code>
* notifications by calling the <code>getNextWarning</code> methods that
* they provide.
* Disconnected <code>Rowset</code> objects, such as a
* <code>CachedRowSet</code> object, do not have access to
* these <code>getNextWarning</code> methods.
*
* @return the first <code>RowSetWarning</code>
* object reported on this <code>JdbcRowSet</code> object
* or <code>null</code> if there are none
* @throws SQLException if this method is called on a closed
* <code>JdbcRowSet</code> object
* @see RowSetWarning
*/
public RowSetWarning getRowSetWarnings() throws SQLException;
/**
* Each <code>JdbcRowSet</code> contains a <code>Connection</code> object from
* the <code>ResultSet</code> or JDBC properties passed to it's constructors.
* This method wraps the <code>Connection</code> commit method to allow flexible
* auto commit or non auto commit transactional control support.
* <p>
* Makes all changes made since the previous commit/rollback permanent
* and releases any database locks currently held by this Connection
* object. This method should be used only when auto-commit mode has
* been disabled.
*
* @throws SQLException if a database access error occurs or this
* Connection object within this <code>JdbcRowSet</code> is in auto-commit mode
* @see java.sql.Connection#setAutoCommit
*/
public void commit() throws SQLException;
/**
* Each <code>JdbcRowSet</code> contains a <code>Connection</code> object from
* the original <code>ResultSet</code> or JDBC properties passed to it. This
* method wraps the <code>Connection</code>'s <code>getAutoCommit</code> method
* to allow an application to determine the <code>JdbcRowSet</code> transaction
* behavior.
* <p>
* Sets this connection's auto-commit mode to the given state. If a
* connection is in auto-commit mode, then all its SQL statements will
* be executed and committed as individual transactions. Otherwise, its
* SQL statements are grouped into transactions that are terminated by a
* call to either the method commit or the method rollback. By default,
* new connections are in auto-commit mode.
*
* @return {@code true} if auto-commit is enabled; {@code false} otherwise
* @throws SQLException if a database access error occurs
* @see java.sql.Connection#getAutoCommit()
*/
public boolean getAutoCommit() throws SQLException;
/**
* Each <code>JdbcRowSet</code> contains a <code>Connection</code> object from
* the original <code>ResultSet</code> or JDBC properties passed to it. This
* method wraps the <code>Connection</code>'s <code>getAutoCommit</code> method
* to allow an application to set the <code>JdbcRowSet</code> transaction behavior.
* <p>
* Sets the current auto-commit mode for this <code>Connection</code> object.
* @param autoCommit {@code true} to enable auto-commit; {@code false} to
* disable auto-commit
* @throws SQLException if a database access error occurs
* @see java.sql.Connection#setAutoCommit(boolean)
*/
public void setAutoCommit(boolean autoCommit) throws SQLException;
/**
* Each <code>JdbcRowSet</code> contains a <code>Connection</code> object from
* the original <code>ResultSet</code> or JDBC properties passed to it.
* Undoes all changes made in the current transaction and releases any
* database locks currently held by this <code>Connection</code> object. This method
* should be used only when auto-commit mode has been disabled.
*
* @throws SQLException if a database access error occurs or this <code>Connection</code>
* object within this <code>JdbcRowSet</code> is in auto-commit mode.
* @see #rollback(Savepoint)
*/
public void rollback() throws SQLException;
/**
* Each <code>JdbcRowSet</code> contains a <code>Connection</code> object from
* the original <code>ResultSet</code> or JDBC properties passed to it.
* Undoes all changes made in the current transaction to the last set savepoint
* and releases any database locks currently held by this <code>Connection</code>
* object. This method should be used only when auto-commit mode has been disabled.
* @param s The {@code Savepoint} to rollback to
* @throws SQLException if a database access error occurs or this <code>Connection</code>
* object within this <code>JdbcRowSet</code> is in auto-commit mode.
* @see #rollback
*/
public void rollback(Savepoint s) throws SQLException;
}

View file

@ -0,0 +1,537 @@
/*
* Copyright (c) 2003, 2013, 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.*;
import javax.sql.*;
import javax.naming.*;
import java.io.*;
import java.math.*;
import java.util.*;
import javax.sql.rowset.*;
/**
* The <code>JoinRowSet</code> interface provides a mechanism for combining related
* data from different <code>RowSet</code> objects into one <code>JoinRowSet</code>
* object, which represents an SQL <code>JOIN</code>.
* In other words, a <code>JoinRowSet</code> object acts as a
* container for the data from <code>RowSet</code> objects that form an SQL
* <code>JOIN</code> relationship.
* <P>
* The <code>Joinable</code> interface provides the methods for setting,
* retrieving, and unsetting a match column, the basis for
* establishing an SQL <code>JOIN</code> relationship. The match column may
* alternatively be set by supplying it to the appropriate version of the
* <code>JointRowSet</code> method <code>addRowSet</code>.
*
* <h3>1.0 Overview</h3>
* Disconnected <code>RowSet</code> objects (<code>CachedRowSet</code> objects
* and implementations extending the <code>CachedRowSet</code> interface)
* do not have a standard way to establish an SQL <code>JOIN</code> between
* <code>RowSet</code> objects without the expensive operation of
* reconnecting to the data source. The <code>JoinRowSet</code>
* interface is specifically designed to address this need.
* <P>
* Any <code>RowSet</code> object
* can be added to a <code>JoinRowSet</code> object to become
* part of an SQL <code>JOIN</code> relationship. This means that both connected
* and disconnected <code>RowSet</code> objects can be part of a <code>JOIN</code>.
* <code>RowSet</code> objects operating in a connected environment
* (<code>JdbcRowSet</code> objects) are
* encouraged to use the database to which they are already
* connected to establish SQL <code>JOIN</code> relationships between
* tables directly. However, it is possible for a
* <code>JdbcRowSet</code> object to be added to a <code>JoinRowSet</code> object
* if necessary.
* <P>
* Any number of <code>RowSet</code> objects can be added to an
* instance of <code>JoinRowSet</code> provided that they
* can be related in an SQL <code>JOIN</code>.
* By definition, the SQL <code>JOIN</code> statement is used to
* combine the data contained in two or more relational database tables based
* upon a common attribute. The <code>Joinable</code> interface provides the methods
* for establishing a common attribute, which is done by setting a
* <i>match column</i>. The match column commonly coincides with
* the primary key, but there is
* no requirement that the match column be the same as the primary key.
* By establishing and then enforcing column matches,
* a <code>JoinRowSet</code> object establishes <code>JOIN</code> relationships
* between <code>RowSet</code> objects without the assistance of an available
* relational database.
* <P>
* The type of <code>JOIN</code> to be established is determined by setting
* one of the <code>JoinRowSet</code> constants using the method
* <code>setJoinType</code>. The following SQL <code>JOIN</code> types can be set:
* <UL>
* <LI><code>CROSS_JOIN</code>
* <LI><code>FULL_JOIN</code>
* <LI><code>INNER_JOIN</code> - the default if no <code>JOIN</code> type has been set
* <LI><code>LEFT_OUTER_JOIN</code>
* <LI><code>RIGHT_OUTER_JOIN</code>
* </UL>
* Note that if no type is set, the <code>JOIN</code> will automatically be an
* inner join. The comments for the fields in the
* <code>JoinRowSet</code> interface explain these <code>JOIN</code> types, which are
* standard SQL <code>JOIN</code> types.
*
* <h3>2.0 Using a <code>JoinRowSet</code> Object for Creating a <code>JOIN</code></h3>
* When a <code>JoinRowSet</code> object is created, it is empty.
* The first <code>RowSet</code> object to be added becomes the basis for the
* <code>JOIN</code> relationship.
* Applications must determine which column in each of the
* <code>RowSet</code> objects to be added to the <code>JoinRowSet</code> object
* should be the match column. All of the
* <code>RowSet</code> objects must contain a match column, and the values in
* each match column must be ones that can be compared to values in the other match
* columns. The columns do not have to have the same name, though they often do,
* and they do not have to store the exact same data type as long as the data types
* can be compared.
* <P>
* A match column can be set in two ways:
* <ul>
* <li>By calling the <code>Joinable</code> method <code>setMatchColumn</code><br>
* This is the only method that can set the match column before a <code>RowSet</code>
* object is added to a <code>JoinRowSet</code> object. The <code>RowSet</code> object
* must have implemented the <code>Joinable</code> interface in order to use the method
* <code>setMatchColumn</code>. Once the match column value
* has been set, this method can be used to reset the match column at any time.
* <li>By calling one of the versions of the <code>JoinRowSet</code> method
* <code>addRowSet</code> that takes a column name or number (or an array of
* column names or numbers)<BR>
* Four of the five <code>addRowSet</code> methods take a match column as a parameter.
* These four methods set or reset the match column at the time a <code>RowSet</code>
* object is being added to a <code>JoinRowSet</code> object.
* </ul>
* <h3>3.0 Sample Usage</h3>
* <p>
* The following code fragment adds two <code>CachedRowSet</code>
* objects to a <code>JoinRowSet</code> object. Note that in this example,
* no SQL <code>JOIN</code> type is set, so the default <code>JOIN</code> type,
* which is <i>INNER_JOIN</i>, is established.
* <p>
* In the following code fragment, the table <code>EMPLOYEES</code>, whose match
* column is set to the first column (<code>EMP_ID</code>), is added to the
* <code>JoinRowSet</code> object <i>jrs</i>. Then
* the table <code>ESSP_BONUS_PLAN</code>, whose match column is likewise
* the <code>EMP_ID</code> column, is added. When this second
* table is added to <i>jrs</i>, only the rows in
* <code>ESSP_BONUS_PLAN</code> whose <code>EMP_ID</code> value matches an
* <code>EMP_ID</code> value in the <code>EMPLOYEES</code> table are added.
* In this case, everyone in the bonus plan is an employee, so all of the rows
* in the table <code>ESSP_BONUS_PLAN</code> are added to the <code>JoinRowSet</code>
* object. In this example, both <code>CachedRowSet</code> objects being added
* have implemented the <code>Joinable</code> interface and can therefore call
* the <code>Joinable</code> method <code>setMatchColumn</code>.
* <PRE>
* JoinRowSet jrs = new JoinRowSetImpl();
*
* ResultSet rs1 = stmt.executeQuery("SELECT * FROM EMPLOYEES");
* CachedRowSet empl = new CachedRowSetImpl();
* empl.populate(rs1);
* empl.setMatchColumn(1);
* jrs.addRowSet(empl);
*
* ResultSet rs2 = stmt.executeQuery("SELECT * FROM ESSP_BONUS_PLAN");
* CachedRowSet bonus = new CachedRowSetImpl();
* bonus.populate(rs2);
* bonus.setMatchColumn(1); // EMP_ID is the first column
* jrs.addRowSet(bonus);
* </PRE>
* <P>
* At this point, <i>jrs</i> is an inside JOIN of the two <code>RowSet</code> objects
* based on their <code>EMP_ID</code> columns. The application can now browse the
* combined data as if it were browsing one single <code>RowSet</code> object.
* Because <i>jrs</i> is itself a <code>RowSet</code> object, an application can
* navigate or modify it using <code>RowSet</code> methods.
* <PRE>
* jrs.first();
* int employeeID = jrs.getInt(1);
* String employeeName = jrs.getString(2);
* </PRE>
* <P>
* Note that because the SQL <code>JOIN</code> must be enforced when an application
* adds a second or subsequent <code>RowSet</code> object, there
* may be an initial degradation in performance while the <code>JOIN</code> is
* being performed.
* <P>
* The following code fragment adds an additional <code>CachedRowSet</code> object.
* In this case, the match column (<code>EMP_ID</code>) is set when the
* <code>CachedRowSet</code> object is added to the <code>JoinRowSet</code> object.
* <PRE>
* ResultSet rs3 = stmt.executeQuery("SELECT * FROM 401K_CONTRIB");
* CachedRowSet fourO1k = new CachedRowSetImpl();
* four01k.populate(rs3);
* jrs.addRowSet(four01k, 1);
* </PRE>
* <P>
* The <code>JoinRowSet</code> object <i>jrs</i> now contains values from all three
* tables. The data in each row in <i>four01k</i> in which the value for the
* <code>EMP_ID</code> column matches a value for the <code>EMP_ID</code> column
* in <i>jrs</i> has been added to <i>jrs</i>.
*
* <h3>4.0 <code>JoinRowSet</code> Methods</h3>
* The <code>JoinRowSet</code> interface supplies several methods for adding
* <code>RowSet</code> objects and for getting information about the
* <code>JoinRowSet</code> object.
* <UL>
* <LI>Methods for adding one or more <code>RowSet</code> objects<BR>
* These methods allow an application to add one <code>RowSet</code> object
* at a time or to add multiple <code>RowSet</code> objects at one time. In
* either case, the methods may specify the match column for each
* <code>RowSet</code> object being added.
* <LI>Methods for getting information<BR>
* One method retrieves the <code>RowSet</code> objects in the
* <code>JoinRowSet</code> object, and another method retrieves the
* <code>RowSet</code> names. A third method retrieves either the SQL
* <code>WHERE</code> clause used behind the scenes to form the
* <code>JOIN</code> or a text description of what the <code>WHERE</code>
* clause does.
* <LI>Methods related to the type of <code>JOIN</code><BR>
* One method sets the <code>JOIN</code> type, and five methods find out whether
* the <code>JoinRowSet</code> object supports a given type.
* <LI>A method to make a separate copy of the <code>JoinRowSet</code> object<BR>
* This method creates a copy that can be persisted to the data source.
* </UL>
*
* @since 1.5
*/
public interface JoinRowSet extends WebRowSet {
/**
* Adds the given <code>RowSet</code> object to this <code>JoinRowSet</code>
* object. If the <code>RowSet</code> object
* is the first to be added to this <code>JoinRowSet</code>
* object, it forms the basis of the <code>JOIN</code> relationship to be
* established.
* <P>
* This method should be used only when the given <code>RowSet</code>
* object already has a match column that was set with the <code>Joinable</code>
* method <code>setMatchColumn</code>.
* <p>
* Note: A <code>Joinable</code> object is any <code>RowSet</code> object
* that has implemented the <code>Joinable</code> interface.
*
* @param rowset the <code>RowSet</code> object that is to be added to this
* <code>JoinRowSet</code> object; it must implement the
* <code>Joinable</code> interface and have a match column set
* @throws SQLException if (1) an empty rowset is added to the to this
* <code>JoinRowSet</code> object, (2) a match column has not been
* set for <i>rowset</i>, or (3) <i>rowset</i>
* violates the active <code>JOIN</code>
* @see Joinable#setMatchColumn
*/
public void addRowSet(Joinable rowset) throws SQLException;
/**
* Adds the given <code>RowSet</code> object to this <code>JoinRowSet</code>
* object and sets the designated column as the match column for
* the <code>RowSet</code> object. If the <code>RowSet</code> object
* is the first to be added to this <code>JoinRowSet</code>
* object, it forms the basis of the <code>JOIN</code> relationship to be
* established.
* <P>
* This method should be used when <i>RowSet</i> does not already have a match
* column set.
*
* @param rowset the <code>RowSet</code> object that is to be added to this
* <code>JoinRowSet</code> object; it may implement the
* <code>Joinable</code> interface
* @param columnIdx an <code>int</code> that identifies the column to become the
* match column
* @throws SQLException if (1) <i>rowset</i> is an empty rowset or
* (2) <i>rowset</i> violates the active <code>JOIN</code>
* @see Joinable#unsetMatchColumn
*/
public void addRowSet(RowSet rowset, int columnIdx) throws SQLException;
/**
* Adds <i>rowset</i> to this <code>JoinRowSet</code> object and
* sets the designated column as the match column. If <i>rowset</i>
* is the first to be added to this <code>JoinRowSet</code>
* object, it forms the basis for the <code>JOIN</code> relationship to be
* established.
* <P>
* This method should be used when the given <code>RowSet</code> object
* does not already have a match column.
*
* @param rowset the <code>RowSet</code> object that is to be added to this
* <code>JoinRowSet</code> object; it may implement the
* <code>Joinable</code> interface
* @param columnName the <code>String</code> object giving the name of the
* column to be set as the match column
* @throws SQLException if (1) <i>rowset</i> is an empty rowset or
* (2) the match column for <i>rowset</i> does not satisfy the
* conditions of the <code>JOIN</code>
*/
public void addRowSet(RowSet rowset,
String columnName) throws SQLException;
/**
* Adds one or more <code>RowSet</code> objects contained in the given
* array of <code>RowSet</code> objects to this <code>JoinRowSet</code>
* object and sets the match column for
* each of the <code>RowSet</code> objects to the match columns
* in the given array of column indexes. The first element in
* <i>columnIdx</i> is set as the match column for the first
* <code>RowSet</code> object in <i>rowset</i>, the second element of
* <i>columnIdx</i> is set as the match column for the second element
* in <i>rowset</i>, and so on.
* <P>
* The first <code>RowSet</code> object added to this <code>JoinRowSet</code>
* object forms the basis for the <code>JOIN</code> relationship.
* <P>
* This method should be used when the given <code>RowSet</code> object
* does not already have a match column.
*
* @param rowset an array of one or more <code>RowSet</code> objects
* to be added to the <code>JOIN</code>; it may implement the
* <code>Joinable</code> interface
* @param columnIdx an array of <code>int</code> values indicating the index(es)
* of the columns to be set as the match columns for the <code>RowSet</code>
* objects in <i>rowset</i>
* @throws SQLException if (1) an empty rowset is added to this
* <code>JoinRowSet</code> object, (2) a match column is not set
* for a <code>RowSet</code> object in <i>rowset</i>, or (3)
* a <code>RowSet</code> object being added violates the active
* <code>JOIN</code>
*/
public void addRowSet(RowSet[] rowset,
int[] columnIdx) throws SQLException;
/**
* Adds one or more <code>RowSet</code> objects contained in the given
* array of <code>RowSet</code> objects to this <code>JoinRowSet</code>
* object and sets the match column for
* each of the <code>RowSet</code> objects to the match columns
* in the given array of column names. The first element in
* <i>columnName</i> is set as the match column for the first
* <code>RowSet</code> object in <i>rowset</i>, the second element of
* <i>columnName</i> is set as the match column for the second element
* in <i>rowset</i>, and so on.
* <P>
* The first <code>RowSet</code> object added to this <code>JoinRowSet</code>
* object forms the basis for the <code>JOIN</code> relationship.
* <P>
* This method should be used when the given <code>RowSet</code> object(s)
* does not already have a match column.
*
* @param rowset an array of one or more <code>RowSet</code> objects
* to be added to the <code>JOIN</code>; it may implement the
* <code>Joinable</code> interface
* @param columnName an array of <code>String</code> values indicating the
* names of the columns to be set as the match columns for the
* <code>RowSet</code> objects in <i>rowset</i>
* @throws SQLException if (1) an empty rowset is added to this
* <code>JoinRowSet</code> object, (2) a match column is not set
* for a <code>RowSet</code> object in <i>rowset</i>, or (3)
* a <code>RowSet</code> object being added violates the active
* <code>JOIN</code>
*/
public void addRowSet(RowSet[] rowset,
String[] columnName) throws SQLException;
/**
* Returns a <code>Collection</code> object containing the
* <code>RowSet</code> objects that have been added to this
* <code>JoinRowSet</code> object.
* This should return the 'n' number of RowSet contained
* within the <code>JOIN</code> and maintain any updates that have occurred while in
* this union.
*
* @return a <code>Collection</code> object consisting of the
* <code>RowSet</code> objects added to this <code>JoinRowSet</code>
* object
* @throws SQLException if an error occurs generating the
* <code>Collection</code> object to be returned
*/
public Collection<?> getRowSets() throws java.sql.SQLException;
/**
* Returns a <code>String</code> array containing the names of the
* <code>RowSet</code> objects added to this <code>JoinRowSet</code>
* object.
*
* @return a <code>String</code> array of the names of the
* <code>RowSet</code> objects in this <code>JoinRowSet</code>
* object
* @throws SQLException if an error occurs retrieving the names of
* the <code>RowSet</code> objects
* @see CachedRowSet#setTableName
*/
public String[] getRowSetNames() throws java.sql.SQLException;
/**
* Creates a new <code>CachedRowSet</code> object containing the
* data in this <code>JoinRowSet</code> object, which can be saved
* to a data source using the <code>SyncProvider</code> object for
* the <code>CachedRowSet</code> object.
* <P>
* If any updates or modifications have been applied to the JoinRowSet
* the CachedRowSet returned by the method will not be able to persist
* it's changes back to the originating rows and tables in the
* in the datasource. The CachedRowSet instance returned should not
* contain modification data and it should clear all properties of
* it's originating SQL statement. An application should reset the
* SQL statement using the <code>RowSet.setCommand</code> method.
* <p>
* In order to allow changes to be persisted back to the datasource
* to the originating tables, the <code>acceptChanges</code> method
* should be used and called on a JoinRowSet object instance. Implementations
* can leverage the internal data and update tracking in their
* implementations to interact with the SyncProvider to persist any
* changes.
*
* @return a CachedRowSet containing the contents of the JoinRowSet
* @throws SQLException if an error occurs assembling the CachedRowSet
* object
* @see javax.sql.RowSet
* @see javax.sql.rowset.CachedRowSet
* @see javax.sql.rowset.spi.SyncProvider
*/
public CachedRowSet toCachedRowSet() throws java.sql.SQLException;
/**
* Indicates if CROSS_JOIN is supported by a JoinRowSet
* implementation
*
* @return true if the CROSS_JOIN is supported; false otherwise
*/
public boolean supportsCrossJoin();
/**
* Indicates if INNER_JOIN is supported by a JoinRowSet
* implementation
*
* @return true is the INNER_JOIN is supported; false otherwise
*/
public boolean supportsInnerJoin();
/**
* Indicates if LEFT_OUTER_JOIN is supported by a JoinRowSet
* implementation
*
* @return true is the LEFT_OUTER_JOIN is supported; false otherwise
*/
public boolean supportsLeftOuterJoin();
/**
* Indicates if RIGHT_OUTER_JOIN is supported by a JoinRowSet
* implementation
*
* @return true is the RIGHT_OUTER_JOIN is supported; false otherwise
*/
public boolean supportsRightOuterJoin();
/**
* Indicates if FULL_JOIN is supported by a JoinRowSet
* implementation
*
* @return true is the FULL_JOIN is supported; false otherwise
*/
public boolean supportsFullJoin();
/**
* Allow the application to adjust the type of <code>JOIN</code> imposed
* on tables contained within the JoinRowSet object instance.
* Implementations should throw a SQLException if they do
* not support a given <code>JOIN</code> type.
*
* @param joinType the standard JoinRowSet.XXX static field definition
* of a SQL <code>JOIN</code> to re-configure a JoinRowSet instance on
* the fly.
* @throws SQLException if an unsupported <code>JOIN</code> type is set
* @see #getJoinType
*/
public void setJoinType(int joinType) throws SQLException;
/**
* Return a SQL-like description of the WHERE clause being used
* in a JoinRowSet object. An implementation can describe
* the WHERE clause of the SQL <code>JOIN</code> by supplying a SQL
* strings description of <code>JOIN</code> or provide a textual
* description to assist applications using a <code>JoinRowSet</code>
*
* @return whereClause a textual or SQL description of the logical
* WHERE clause used in the JoinRowSet instance
* @throws SQLException if an error occurs in generating a representation
* of the WHERE clause.
*/
public String getWhereClause() throws SQLException;
/**
* Returns a <code>int</code> describing the set SQL <code>JOIN</code> type
* governing this JoinRowSet instance. The returned type will be one of
* standard JoinRowSet types: <code>CROSS_JOIN</code>, <code>INNER_JOIN</code>,
* <code>LEFT_OUTER_JOIN</code>, <code>RIGHT_OUTER_JOIN</code> or
* <code>FULL_JOIN</code>.
*
* @return joinType one of the standard JoinRowSet static field
* definitions of a SQL <code>JOIN</code>. <code>JoinRowSet.INNER_JOIN</code>
* is returned as the default <code>JOIN</code> type is no type has been
* explicitly set.
* @throws SQLException if an error occurs determining the SQL <code>JOIN</code>
* type supported by the JoinRowSet instance.
* @see #setJoinType
*/
public int getJoinType() throws SQLException;
/**
* An ANSI-style <code>JOIN</code> providing a cross product of two tables
*/
public static int CROSS_JOIN = 0;
/**
* An ANSI-style <code>JOIN</code> providing a inner join between two tables. Any
* unmatched rows in either table of the join should be discarded.
*/
public static int INNER_JOIN = 1;
/**
* An ANSI-style <code>JOIN</code> providing a left outer join between two
* tables. In SQL, this is described where all records should be
* returned from the left side of the JOIN statement.
*/
public static int LEFT_OUTER_JOIN = 2;
/**
* An ANSI-style <code>JOIN</code> providing a right outer join between
* two tables. In SQL, this is described where all records from the
* table on the right side of the JOIN statement even if the table
* on the left has no matching record.
*/
public static int RIGHT_OUTER_JOIN = 3;
/**
* An ANSI-style <code>JOIN</code> providing a full JOIN. Specifies that all
* rows from either table be returned regardless of matching
* records on the other table.
*/
public static int FULL_JOIN = 4;
}

View file

@ -0,0 +1,292 @@
/*
* Copyright (c) 2003, 2013, 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;
/**
* <h3>1.0 Background</h3>
* The <code>Joinable</code> interface provides the methods for getting and
* setting a match column, which is the basis for forming the SQL <code>JOIN</code>
* formed by adding <code>RowSet</code> objects to a <code>JoinRowSet</code>
* object.
* <P>
* Any standard <code>RowSet</code> implementation <b>may</b> implement
* the <code>Joinable</code> interface in order to be
* added to a <code>JoinRowSet</code> object. Implementing this interface gives
* a <code>RowSet</code> object the ability to use <code>Joinable</code> methods,
* which set, retrieve, and get information about match columns. An
* application may add a
* <code>RowSet</code> object that has not implemented the <code>Joinable</code>
* interface to a <code>JoinRowSet</code> object, but to do so it must use one
* of the <code>JoinRowSet.addRowSet</code> methods that takes both a
* <code>RowSet</code> object and a match column or an array of <code>RowSet</code>
* objects and an array of match columns.
* <P>
* To get access to the methods in the <code>Joinable</code> interface, a
* <code>RowSet</code> object implements at least one of the
* five standard <code>RowSet</code> interfaces and also implements the
* <code>Joinable</code> interface. In addition, most <code>RowSet</code>
* objects extend the <code>BaseRowSet</code> class. For example:
* <pre>
* class MyRowSetImpl extends BaseRowSet implements CachedRowSet, Joinable {
* :
* :
* }
* </pre>
*
* <h3>2.0 Usage Guidelines</h3>
* <P>
* The methods in the <code>Joinable</code> interface allow a <code>RowSet</code> object
* to set a match column, retrieve a match column, or unset a match column, which is
* the column upon which an SQL <code>JOIN</code> can be based.
* An instance of a class that implements these methods can be added to a
* <code>JoinRowSet</code> object to allow an SQL <code>JOIN</code> relationship to
* be established.
*
* <pre>
* CachedRowSet crs = new MyRowSetImpl();
* crs.populate((ResultSet)rs);
* (Joinable)crs.setMatchColumnIndex(1);
*
* JoinRowSet jrs = new JoinRowSetImpl();
* jrs.addRowSet(crs);
* </pre>
* In the previous example, <i>crs</i> is a <code>CachedRowSet</code> object that
* has implemented the <code>Joinable</code> interface. In the following example,
* <i>crs2</i> has not, so it must supply the match column as an argument to the
* <code>addRowSet</code> method. This example assumes that column 1 is the match
* column.
* <PRE>
* CachedRowSet crs2 = new MyRowSetImpl();
* crs2.populate((ResultSet)rs);
*
* JoinRowSet jrs2 = new JoinRowSetImpl();
* jrs2.addRowSet(crs2, 1);
* </PRE>
* <p>
* The <code>JoinRowSet</code> interface makes it possible to get data from one or
* more <code>RowSet</code> objects consolidated into one table without having to incur
* the expense of creating a connection to a database. It is therefore ideally suited
* for use by disconnected <code>RowSet</code> objects. Nevertheless, any
* <code>RowSet</code> object <b>may</b> implement this interface
* regardless of whether it is connected or disconnected. Note that a
* <code>JdbcRowSet</code> object, being always connected to its data source, can
* become part of an SQL <code>JOIN</code> directly without having to become part
* of a <code>JoinRowSet</code> object.
*
* <h3>3.0 Managing Multiple Match Columns</h3>
* The index array passed into the <code>setMatchColumn</code> methods indicates
* how many match columns are being set (the length of the array) in addition to
* which columns will be used for the match. For example:
* <pre>
* int[] i = {1, 2, 4, 7}; // indicates four match columns, with column
* // indexes 1, 2, 4, 7 participating in the JOIN.
* Joinable.setMatchColumn(i);
* </pre>
* Subsequent match columns may be added as follows to a different <code>Joinable</code>
* object (a <code>RowSet</code> object that has implemented the <code>Joinable</code>
* interface).
* <pre>
* int[] w = {3, 2, 5, 3};
* Joinable2.setMatchColumn(w);
* </pre>
* When an application adds two or more <code>RowSet</code> objects to a
* <code>JoinRowSet</code> object, the order of the indexes in the array is
* particularly important. Each index of
* the array maps directly to the corresponding index of the previously added
* <code>RowSet</code> object. If overlap or underlap occurs, the match column
* data is maintained in the event an additional <code>Joinable</code> RowSet is
* added and needs to relate to the match column data. Therefore, applications
* can set multiple match columns in any order, but
* this order has a direct effect on the outcome of the <code>SQL</code> JOIN.
* <p>
* This assertion applies in exactly the same manner when column names are used
* rather than column indexes to indicate match columns.
*
* @see JoinRowSet
* @author Jonathan Bruce
* @since 1.5
*/
public interface Joinable {
/**
* Sets the designated column as the match column for this <code>RowSet</code>
* object. A <code>JoinRowSet</code> object can now add this <code>RowSet</code>
* object based on the match column.
* <p>
* Sub-interfaces such as the <code>CachedRowSet</code>&trade;
* interface define the method <code>CachedRowSet.setKeyColumns</code>, which allows
* primary key semantics to be enforced on specific columns.
* Implementations of the <code>setMatchColumn(int columnIdx)</code> method
* should ensure that the constraints on the key columns are maintained when
* a <code>CachedRowSet</code> object sets a primary key column as a match column.
*
* @param columnIdx an <code>int</code> identifying the index of the column to be
* set as the match column
* @throws SQLException if an invalid column index is set
* @see #setMatchColumn(int[])
* @see #unsetMatchColumn(int)
*
*/
public void setMatchColumn(int columnIdx) throws SQLException;
/**
* Sets the designated columns as the match column for this <code>RowSet</code>
* object. A <code>JoinRowSet</code> object can now add this <code>RowSet</code>
* object based on the match column.
*
* @param columnIdxes an array of <code>int</code> identifying the indexes of the
* columns to be set as the match columns
* @throws SQLException if an invalid column index is set
* @see #setMatchColumn(int[])
* @see #unsetMatchColumn(int[])
*/
public void setMatchColumn(int[] columnIdxes) throws SQLException;
/**
* Sets the designated column as the match column for this <code>RowSet</code>
* object. A <code>JoinRowSet</code> object can now add this <code>RowSet</code>
* object based on the match column.
* <p>
* Subinterfaces such as the <code>CachedRowSet</code> interface define
* the method <code>CachedRowSet.setKeyColumns</code>, which allows
* primary key semantics to be enforced on specific columns.
* Implementations of the <code>setMatchColumn(String columnIdx)</code> method
* should ensure that the constraints on the key columns are maintained when
* a <code>CachedRowSet</code> object sets a primary key column as a match column.
*
* @param columnName a <code>String</code> object giving the name of the column
* to be set as the match column
* @throws SQLException if an invalid column name is set, the column name
* is a null, or the column name is an empty string
* @see #unsetMatchColumn
* @see #setMatchColumn(int[])
*/
public void setMatchColumn(String columnName) throws SQLException;
/**
* Sets the designated columns as the match column for this <code>RowSet</code>
* object. A <code>JoinRowSet</code> object can now add this <code>RowSet</code>
* object based on the match column.
*
* @param columnNames an array of <code>String</code> objects giving the names
* of the column to be set as the match columns
* @throws SQLException if an invalid column name is set, the column name
* is a null, or the column name is an empty string
* @see #unsetMatchColumn
* @see #setMatchColumn(int[])
*/
public void setMatchColumn(String[] columnNames) throws SQLException;
/**
* Retrieves the indexes of the match columns that were set for this
* <code>RowSet</code> object with the method
* <code>setMatchColumn(int[] columnIdxes)</code>.
*
* @return an <code>int</code> array identifying the indexes of the columns
* that were set as the match columns for this <code>RowSet</code> object
* @throws SQLException if no match column has been set
* @see #setMatchColumn
* @see #unsetMatchColumn
*/
public int[] getMatchColumnIndexes() throws SQLException;
/**
* Retrieves the names of the match columns that were set for this
* <code>RowSet</code> object with the method
* <code>setMatchColumn(String [] columnNames)</code>.
*
* @return an array of <code>String</code> objects giving the names of the columns
* set as the match columns for this <code>RowSet</code> object
* @throws SQLException if no match column has been set
* @see #setMatchColumn
* @see #unsetMatchColumn
*
*/
public String[] getMatchColumnNames() throws SQLException;
/**
* Unsets the designated column as the match column for this <code>RowSet</code>
* object.
* <P>
* <code>RowSet</code> objects that implement the <code>Joinable</code> interface
* must ensure that a key-like constraint continues to be enforced until the
* method <code>CachedRowSet.unsetKeyColumns</code> has been called on the
* designated column.
*
* @param columnIdx an <code>int</code> that identifies the index of the column
* that is to be unset as a match column
* @throws SQLException if an invalid column index is designated or if
* the designated column was not previously set as a match
* column
* @see #setMatchColumn
*/
public void unsetMatchColumn(int columnIdx) throws SQLException;
/**
* Unsets the designated columns as the match column for this <code>RowSet</code>
* object.
*
* @param columnIdxes an array of <code>int</code> that identifies the indexes
* of the columns that are to be unset as match columns
* @throws SQLException if an invalid column index is designated or if
* the designated column was not previously set as a match
* column
* @see #setMatchColumn
*/
public void unsetMatchColumn(int[] columnIdxes) throws SQLException;
/**
* Unsets the designated column as the match column for this <code>RowSet</code>
* object.
* <P>
* <code>RowSet</code> objects that implement the <code>Joinable</code> interface
* must ensure that a key-like constraint continues to be enforced until the
* method <code>CachedRowSet.unsetKeyColumns</code> has been called on the
* designated column.
*
* @param columnName a <code>String</code> object giving the name of the column
* that is to be unset as a match column
* @throws SQLException if an invalid column name is designated or
* the designated column was not previously set as a match
* column
* @see #setMatchColumn
*/
public void unsetMatchColumn(String columnName) throws SQLException;
/**
* Unsets the designated columns as the match columns for this <code>RowSet</code>
* object.
*
* @param columnName an array of <code>String</code> objects giving the names of
* the columns that are to be unset as the match columns
* @throws SQLException if an invalid column name is designated or the
* designated column was not previously set as a match column
* @see #setMatchColumn
*/
public void unsetMatchColumn(String[] columnName) throws SQLException;
}

View file

@ -0,0 +1,163 @@
/*
* Copyright (c) 2003, 2014, 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 javax.sql.*;
import java.sql.*;
/**
* The standard interface that provides the framework for all
* <code>FilteredRowSet</code> objects to describe their filters.
*
* <h3>1.0 Background</h3>
* The <code>Predicate</code> interface is a standard interface that
* applications can implement to define the filter they wish to apply to a
* a <code>FilteredRowSet</code> object. A <code>FilteredRowSet</code>
* object consumes implementations of this interface and enforces the
* constraints defined in the implementation of the method <code>evaluate</code>.
* A <code>FilteredRowSet</code> object enforces the filter constraints in a
* bi-directional manner: It outputs only rows that are within
* the constraints of the filter; and conversely, it inserts, modifies, or updates
* only rows that are within the constraints of the filter.
*
* <h3>2.0 Implementation Guidelines</h3>
* In order to supply a predicate for the <code>FilteredRowSet</code>.
* this interface must be implemented. At this time, the JDBC RowSet
* Implementations (JSR-114) does not specify any standard filters definitions.
* By specifying a standard means and mechanism for a range of filters to be
* defined and deployed with both the reference and vendor implementations
* of the <code>FilteredRowSet</code> interface, this allows for a flexible
* and application motivated implementations of <code>Predicate</code> to emerge.
* <p>
* A sample implementation would look something like this:
* <pre>{@code
* public class Range implements Predicate {
*
* private int[] lo;
* private int[] hi;
* private int[] idx;
*
* public Range(int[] lo, int[] hi, int[] idx) {
* this.lo = lo;
* this.hi = hi;
* this.idx = idx;
* }
*
* public boolean evaluate(RowSet rs) {
*
* // Check the present row determine if it lies
* // within the filtering criteria.
*
* for (int i = 0; i < idx.length; i++) {
* int value;
* try {
* value = (Integer) rs.getObject(idx[i]);
* } catch (SQLException ex) {
* Logger.getLogger(Range.class.getName()).log(Level.SEVERE, null, ex);
* return false;
* }
*
* if (value < lo[i] && value > hi[i]) {
* // outside of filter constraints
* return false;
* }
* }
* // Within filter constraints
* return true;
* }
* }
* }</pre>
* <P>
* The example above implements a simple range predicate. Note, that
* implementations should but are not required to provide <code>String</code>
* and integer index based constructors to provide for JDBC RowSet Implementation
* applications that use both column identification conventions.
*
* @author Jonathan Bruce, Amit Handa
* @since 1.5
*
*/
// <h3>3.0 FilteredRowSet Internals</h3>
// internalNext, First, Last. Discuss guidelines on how to approach this
// and cite examples in reference implementations.
public interface Predicate {
/**
* This method is typically called a <code>FilteredRowSet</code> object
* internal methods (not public) that control the <code>RowSet</code> object's
* cursor moving from row to the next. In addition, if this internal method
* moves the cursor onto a row that has been deleted, the internal method will
* continue to ove the cursor until a valid row is found.
* @param rs The {@code RowSet} to be evaluated
* @return <code>true</code> if there are more rows in the filter;
* <code>false</code> otherwise
*/
public boolean evaluate(RowSet rs);
/**
* This method is called by a <code>FilteredRowSet</code> object
* to check whether the value lies between the filtering criterion (or criteria
* if multiple constraints exist) set using the <code>setFilter()</code> method.
* <P>
* The <code>FilteredRowSet</code> object will use this method internally
* while inserting new rows to a <code>FilteredRowSet</code> instance.
*
* @param value An <code>Object</code> value which needs to be checked,
* whether it can be part of this <code>FilterRowSet</code> object.
* @param column a <code>int</code> object that must match the
* SQL index of a column in this <code>RowSet</code> object. This must
* have been passed to <code>Predicate</code> as one of the columns
* for filtering while initializing a <code>Predicate</code>
* @return <code>true</code> if row value lies within the filter;
* <code>false</code> otherwise
* @throws SQLException if the column is not part of filtering criteria
*/
public boolean evaluate(Object value, int column) throws SQLException;
/**
* This method is called by the <code>FilteredRowSet</code> object
* to check whether the value lies between the filtering criteria set
* using the setFilter method.
* <P>
* The <code>FilteredRowSet</code> object will use this method internally
* while inserting new rows to a <code>FilteredRowSet</code> instance.
*
* @param value An <code>Object</code> value which needs to be checked,
* whether it can be part of this <code>FilterRowSet</code>.
*
* @param columnName a <code>String</code> object that must match the
* SQL name of a column in this <code>RowSet</code>, ignoring case. This must
* have been passed to <code>Predicate</code> as one of the columns for filtering
* while initializing a <code>Predicate</code>
*
* @return <code>true</code> if value lies within the filter; <code>false</code> otherwise
*
* @throws SQLException if the column is not part of filtering criteria
*/
public boolean evaluate(Object value, String columnName) throws SQLException;
}

View file

@ -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{
/**
* <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;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,339 @@
/*
* Copyright (c) 2010, 2013, 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.PropertyPermission;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import sun.reflect.misc.ReflectUtil;
/**
* 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);
}
/**
* RowSetProvider constructor
*/
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 {@link ServiceLoader} API. The {@code ServiceLoader} API will look
* for a class name in the file
* {@code META-INF/services/javax.sql.rowset.RowSetFactory}
* in jars available to the runtime. For example, to have 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);
if (factoryClassName.equals(ROWSET_FACTORY_IMPL)) {
return defaultRowSetFactory();
}
// getFactoryClass takes care of adding the read edge if
// necessary
@SuppressWarnings("deprecation")
Object o = getFactoryClass(factoryClassName, null, false).newInstance();
factory = (RowSetFactory) o;
}
} catch (Exception e) {
throw new SQLException( "RowSetFactory: " + factoryClassName +
" could not be instantiated: ", 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();
}
return factory == null ? defaultRowSetFactory() : factory;
}
private static RowSetFactory defaultRowSetFactory() {
return new com.sun.rowset.RowSetFactoryImpl();
}
/**
* <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()");
if(factoryClassName == null) {
throw new SQLException("Error: factoryClassName cannot be null");
}
try {
ReflectUtil.checkPackageAccess(factoryClassName);
} catch (java.security.AccessControlException e) {
throw new SQLException("Access Exception",e);
}
try {
// getFactoryClass takes care of adding the read edge if
// necessary
Class<?> providerClass = getFactoryClass(factoryClassName, cl, false);
@SuppressWarnings("deprecation")
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 AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
public ClassLoader 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 {
Class<?> factoryClass = null;
try {
if (cl == null) {
cl = getContextClassLoader();
if (cl == null) {
throw new ClassNotFoundException();
} else {
factoryClass = cl.loadClass(factoryClassName);
}
} else {
factoryClass = cl.loadClass(factoryClassName);
}
} catch (ClassNotFoundException e) {
if (doFallback) {
// Use current class loader
factoryClass = Class.forName(factoryClassName, true, RowSetFactory.class.getClassLoader());
} else {
throw e;
}
}
ReflectUtil.checkPackageAccess(factoryClass);
return factoryClass;
}
/**
* Use the ServiceLoader mechanism to load the default RowSetFactory
* @return default RowSetFactory Implementation
*/
static private RowSetFactory loadViaServiceLoader() throws SQLException {
RowSetFactory theFactory = null;
try {
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;
}
} catch (ServiceConfigurationError e) {
throw new SQLException(
"RowSetFactory: Error locating RowSetFactory using Service "
+ "Loader API: " + e, e);
}
return theFactory;
}
/**
* Returns the requested System Property. If a {@code SecurityException}
* occurs, just return NULL
* @param propName - System property to retrieve
* @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 = AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty(propName);
}
}, null, new PropertyPermission(propName, "read"));
} catch (SecurityException se) {
trace("error getting " + propName + ": "+ 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);
}
}
}

View file

@ -0,0 +1,151 @@
/*
* Copyright (c) 2003, 2014, 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 extension of <code>SQLException</code> that provides information
* about database warnings set on <code>RowSet</code> objects.
* Warnings are silently chained to the object whose method call
* caused it to be reported.
* This class complements the <code>SQLWarning</code> class.
* <P>
* Rowset warnings may be retrieved from <code>JdbcRowSet</code>,
* <code>CachedRowSet</code>&trade;,
* <code>WebRowSet</code>, <code>FilteredRowSet</code>, or <code>JoinRowSet</code>
* implementations. To retrieve the first warning reported on any
* <code>RowSet</code>
* implementation, use the method <code>getRowSetWarnings</code> defined
* in the <code>JdbcRowSet</code> interface or the <code>CachedRowSet</code>
* interface. To retrieve a warning chained to the first warning, use the
* <code>RowSetWarning</code> method
* <code>getNextWarning</code>. To retrieve subsequent warnings, call
* <code>getNextWarning</code> on each <code>RowSetWarning</code> object that is
* returned.
* <P>
* The inherited methods <code>getMessage</code>, <code>getSQLState</code>,
* and <code>getErrorCode</code> retrieve information contained in a
* <code>RowSetWarning</code> object.
*
* @since 1.5
*/
public class RowSetWarning extends SQLException {
/**
* Constructs a <code>RowSetWarning</code> object
* with the given value for the reason; SQLState defaults to null,
* and vendorCode defaults to 0.
*
* @param reason a <code>String</code> object giving a description
* of the warning; if the <code>String</code> is <code>null</code>,
* this constructor behaves like the default (zero parameter)
* <code>RowSetWarning</code> constructor
*/
public RowSetWarning(String reason) {
super(reason);
}
/**
* Constructs a default <code>RowSetWarning</code> object. The reason
* defaults to <code>null</code>, SQLState defaults to null and vendorCode
* defaults to 0.
*/
public RowSetWarning() {
super();
}
/**
* Constructs a <code>RowSetWarning</code> object initialized with the
* given values for the reason and SQLState. The vendor code defaults to 0.
*
* If the <code>reason</code> or <code>SQLState</code> parameters are <code>null</code>,
* this constructor behaves like the default (zero parameter)
* <code>RowSetWarning</code> constructor.
*
* @param reason a <code>String</code> giving a description of the
* warning;
* @param SQLState an XOPEN code identifying the warning; if a non standard
* XOPEN <i>SQLState</i> is supplied, no exception is thrown.
*/
public RowSetWarning(java.lang.String reason, java.lang.String SQLState) {
super(reason, SQLState);
}
/**
* Constructs a fully specified <code>RowSetWarning</code> object initialized
* with the given values for the reason, SQLState and vendorCode.
*
* If the <code>reason</code>, or the <code>SQLState</code>
* parameters are <code>null</code>, this constructor behaves like the default
* (zero parameter) <code>RowSetWarning</code> constructor.
*
* @param reason a <code>String</code> giving a description of the
* warning;
* @param SQLState an XOPEN code identifying the warning; if a non standard
* XOPEN <i>SQLState</i> is supplied, no exception is thrown.
* @param vendorCode a database vendor-specific warning code
*/
public RowSetWarning(java.lang.String reason, java.lang.String SQLState, int vendorCode) {
super(reason, SQLState, vendorCode);
}
/**
* Retrieves the warning chained to this <code>RowSetWarning</code>
* object.
*
* @return the <code>RowSetWarning</code> object chained to this one; if no
* <code>RowSetWarning</code> object is chained to this one,
* <code>null</code> is returned (default value)
* @see #setNextWarning
*/
public RowSetWarning getNextWarning() {
SQLException warning = getNextException();
if ( warning == null || warning instanceof RowSetWarning) {
return (RowSetWarning)warning;
} else {
// The chained value isn't a RowSetWarning.
// This is a programming error by whoever added it to
// the RowSetWarning chain. We throw a Java "Error".
throw new Error("RowSetWarning chain holds value that is not a RowSetWarning: ");
}
}
/**
* Sets <i>warning</i> as the next warning, that is, the warning chained
* to this <code>RowSetWarning</code> object.
*
* @param warning the <code>RowSetWarning</code> object to be set as the
* next warning; if the <code>RowSetWarning</code> is null, this
* represents the finish point in the warning chain
* @see #getNextWarning
*/
public void setNextWarning(RowSetWarning warning) {
setNextException(warning);
}
static final long serialVersionUID = 6678332766434564774L;
}

View file

@ -0,0 +1,506 @@
/*
* Copyright (c) 2003, 2014, 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.*;
import javax.sql.*;
import javax.naming.*;
import java.io.*;
import java.math.*;
import org.xml.sax.*;
/**
* The standard interface that all implementations of a {@code WebRowSet}
* must implement.
*
* <h3>1.0 Overview</h3>
* The {@code WebRowSetImpl} provides the standard
* reference implementation, which may be extended if required.
* <P>
* The standard WebRowSet XML Schema definition is available at the following
* URI:
* <ul>
* <li>
* <a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">http://java.sun.com/xml/ns/jdbc/webrowset.xsd</a>
* </li>
* </ul>
* It describes the standard XML document format required when describing a
* {@code RowSet} object in XML and must be used be all standard implementations
* of the {@code WebRowSet} interface to ensure interoperability. In addition,
* the {@code WebRowSet} schema uses specific SQL/XML Schema annotations,
* thus ensuring greater cross
* platform interoperability. This is an effort currently under way at the ISO
* organization. The SQL/XML definition is available at the following URI:
* <ul>
* <li>
* <a href="http://standards.iso.org/iso/9075/2002/12/sqlxml.xsd">http://standards.iso.org/iso/9075/2002/12/sqlxml.xsd</a>
* </li>
* </ul>
* The schema definition describes the internal data of a {@code RowSet} object
* in three distinct areas:
* <UL>
* <li>properties - These properties describe the standard synchronization
* provider properties in addition to the more general {@code RowSet} properties.
* </li>
* <li>metadata - This describes the metadata associated with the tabular structure governed by a
* {@code WebRowSet} object. The metadata described is closely aligned with the
* metadata accessible in the underlying {@code java.sql.ResultSet} interface.
* </li>
* <li>data - This describes the original data (the state of data since the
* last population
* or last synchronization of the {@code WebRowSet} object) and the current
* data. By keeping track of the delta between the original data and the current data,
* a {@code WebRowSet} maintains the ability to synchronize changes
* in its data back to the originating data source.
* </li>
* </ul>
*
* <h3>2.0 WebRowSet States</h3>
* The following sections demonstrates how a {@code WebRowSet} implementation
* should use the XML Schema to describe update, insert, and delete operations
* and to describe the state of a {@code WebRowSet} object in XML.
*
* <h4>2.1 State 1 - Outputting a {@code WebRowSet} Object to XML</h4>
* In this example, a {@code WebRowSet} object is created and populated with a simple 2 column,
* 5 row table from a data source. Having the 5 rows in a {@code WebRowSet} object
* makes it possible to describe them in XML. The
* metadata describing the various standard JavaBeans properties as defined
* in the RowSet interface plus the standard properties defined in
* the {@code CachedRowSet}&trade; interface
* provide key details that describe WebRowSet
* properties. Outputting the WebRowSet object to XML using the standard
* {@code writeXml} methods describes the internal properties as follows:
* <PRE>
* {@code
* <properties>
* <command>select co1, col2 from test_table</command>
* <concurrency>1</concurrency>
* <datasource/>
* <escape-processing>true</escape-processing>
* <fetch-direction>0</fetch-direction>
* <fetch-size>0</fetch-size>
* <isolation-level>1</isolation-level>
* <key-columns/>
* <map/>
* <max-field-size>0</max-field-size>
* <max-rows>0</max-rows>
* <query-timeout>0</query-timeout>
* <read-only>false</read-only>
* <rowset-type>TRANSACTION_READ_UNCOMMITTED</rowset-type>
* <show-deleted>false</show-deleted>
* <table-name/>
* <url>jdbc:thin:oracle</url>
* <sync-provider>
* <sync-provider-name>.com.rowset.provider.RIOptimisticProvider</sync-provider-name>
* <sync-provider-vendor>Oracle Corporation</sync-provider-vendor>
* <sync-provider-version>1.0</sync-provider-name>
* <sync-provider-grade>LOW</sync-provider-grade>
* <data-source-lock>NONE</data-source-lock>
* </sync-provider>
* </properties>
* } </PRE>
* The meta-data describing the make up of the WebRowSet is described
* in XML as detailed below. Note both columns are described between the
* {@code column-definition} tags.
* <PRE>
* {@code
* <metadata>
* <column-count>2</column-count>
* <column-definition>
* <column-index>1</column-index>
* <auto-increment>false</auto-increment>
* <case-sensitive>true</case-sensitive>
* <currency>false</currency>
* <nullable>1</nullable>
* <signed>false</signed>
* <searchable>true</searchable>
* <column-display-size>10</column-display-size>
* <column-label>COL1</column-label>
* <column-name>COL1</column-name>
* <schema-name/>
* <column-precision>10</column-precision>
* <column-scale>0</column-scale>
* <table-name/>
* <catalog-name/>
* <column-type>1</column-type>
* <column-type-name>CHAR</column-type-name>
* </column-definition>
* <column-definition>
* <column-index>2</column-index>
* <auto-increment>false</auto-increment>
* <case-sensitive>false</case-sensitive>
* <currency>false</currency>
* <nullable>1</nullable>
* <signed>true</signed>
* <searchable>true</searchable>
* <column-display-size>39</column-display-size>
* <column-label>COL2</column-label>
* <column-name>COL2</column-name>
* <schema-name/>
* <column-precision>38</column-precision>
* <column-scale>0</column-scale>
* <table-name/>
* <catalog-name/>
* <column-type>3</column-type>
* <column-type-name>NUMBER</column-type-name>
* </column-definition>
* </metadata>
* }</PRE>
* Having detailed how the properties and metadata are described, the following details
* how the contents of a {@code WebRowSet} object is described in XML. Note, that
* this describes a {@code WebRowSet} object that has not undergone any
* modifications since its instantiation.
* A {@code currentRow} tag is mapped to each row of the table structure that the
* {@code WebRowSet} object provides. A {@code columnValue} tag may contain
* either the {@code stringData} or {@code binaryData} tag, according to
* the SQL type that
* the XML value is mapping back to. The {@code binaryData} tag contains data in the
* Base64 encoding and is typically used for {@code BLOB} and {@code CLOB} type data.
* <PRE>
* {@code
* <data>
* <currentRow>
* <columnValue>
* firstrow
* </columnValue>
* <columnValue>
* 1
* </columnValue>
* </currentRow>
* <currentRow>
* <columnValue>
* secondrow
* </columnValue>
* <columnValue>
* 2
* </columnValue>
* </currentRow>
* <currentRow>
* <columnValue>
* thirdrow
* </columnValue>
* <columnValue>
* 3
* </columnValue>
* </currentRow>
* <currentRow>
* <columnValue>
* fourthrow
* </columnValue>
* <columnValue>
* 4
* </columnValue>
* </currentRow>
* </data>
* }</PRE>
* <h4>2.2 State 2 - Deleting a Row</h4>
* Deleting a row in a {@code WebRowSet} object involves simply moving to the row
* to be deleted and then calling the method {@code deleteRow}, as in any other
* {@code RowSet} object. The following
* two lines of code, in which <i>wrs</i> is a {@code WebRowSet} object, delete
* the third row.
* <PRE>
* wrs.absolute(3);
* wrs.deleteRow();
* </PRE>
* The XML description shows the third row is marked as a {@code deleteRow},
* which eliminates the third row in the {@code WebRowSet} object.
* <PRE>
* {@code
* <data>
* <currentRow>
* <columnValue>
* firstrow
* </columnValue>
* <columnValue>
* 1
* </columnValue>
* </currentRow>
* <currentRow>
* <columnValue>
* secondrow
* </columnValue>
* <columnValue>
* 2
* </columnValue>
* </currentRow>
* <deleteRow>
* <columnValue>
* thirdrow
* </columnValue>
* <columnValue>
* 3
* </columnValue>
* </deleteRow>
* <currentRow>
* <columnValue>
* fourthrow
* </columnValue>
* <columnValue>
* 4
* </columnValue>
* </currentRow>
* </data>
*} </PRE>
* <h4>2.3 State 3 - Inserting a Row</h4>
* A {@code WebRowSet} object can insert a new row by moving to the insert row,
* calling the appropriate updater methods for each column in the row, and then
* calling the method {@code insertRow}.
* <PRE>
* {@code
* wrs.moveToInsertRow();
* wrs.updateString(1, "fifththrow");
* wrs.updateString(2, "5");
* wrs.insertRow();
* }</PRE>
* The following code fragment changes the second column value in the row just inserted.
* Note that this code applies when new rows are inserted right after the current row,
* which is why the method {@code next} moves the cursor to the correct row.
* Calling the method {@code acceptChanges} writes the change to the data source.
*
* <PRE>
* {@code wrs.moveToCurrentRow();
* wrs.next();
* wrs.updateString(2, "V");
* wrs.acceptChanges();
* }</PRE>
* Describing this in XML demonstrates where the Java code inserts a new row and then
* performs an update on the newly inserted row on an individual field.
* <PRE>
* {@code
* <data>
* <currentRow>
* <columnValue>
* firstrow
* </columnValue>
* <columnValue>
* 1
* </columnValue>
* </currentRow>
* <currentRow>
* <columnValue>
* secondrow
* </columnValue>
* <columnValue>
* 2
* </columnValue>
* </currentRow>
* <currentRow>
* <columnValue>
* newthirdrow
* </columnValue>
* <columnValue>
* III
* </columnValue>
* </currentRow>
* <insertRow>
* <columnValue>
* fifthrow
* </columnValue>
* <columnValue>
* 5
* </columnValue>
* <updateValue>
* V
* </updateValue>
* </insertRow>
* <currentRow>
* <columnValue>
* fourthrow
* </columnValue>
* <columnValue>
* 4
* </columnValue>
* </currentRow>
* </date>
*} </PRE>
* <h4>2.4 State 4 - Modifying a Row</h4>
* Modifying a row produces specific XML that records both the new value and the
* value that was replaced. The value that was replaced becomes the original value,
* and the new value becomes the current value. The following
* code moves the cursor to a specific row, performs some modifications, and updates
* the row when complete.
* <PRE>
*{@code
* wrs.absolute(5);
* wrs.updateString(1, "new4thRow");
* wrs.updateString(2, "IV");
* wrs.updateRow();
* }</PRE>
* In XML, this is described by the {@code modifyRow} tag. Both the original and new
* values are contained within the tag for original row tracking purposes.
* <PRE>
* {@code
* <data>
* <currentRow>
* <columnValue>
* firstrow
* </columnValue>
* <columnValue>
* 1
* </columnValue>
* </currentRow>
* <currentRow>
* <columnValue>
* secondrow
* </columnValue>
* <columnValue>
* 2
* </columnValue>
* </currentRow>
* <currentRow>
* <columnValue>
* newthirdrow
* </columnValue>
* <columnValue>
* III
* </columnValue>
* </currentRow>
* <currentRow>
* <columnValue>
* fifthrow
* </columnValue>
* <columnValue>
* 5
* </columnValue>
* </currentRow>
* <modifyRow>
* <columnValue>
* fourthrow
* </columnValue>
* <updateValue>
* new4thRow
* </updateValue>
* <columnValue>
* 4
* </columnValue>
* <updateValue>
* IV
* </updateValue>
* </modifyRow>
* </data>
* }</PRE>
*
* @see javax.sql.rowset.JdbcRowSet
* @see javax.sql.rowset.CachedRowSet
* @see javax.sql.rowset.FilteredRowSet
* @see javax.sql.rowset.JoinRowSet
* @since 1.5
*/
public interface WebRowSet extends CachedRowSet {
/**
* Reads a {@code WebRowSet} object in its XML format from the given
* {@code Reader} object.
*
* @param reader the {@code java.io.Reader} stream from which this
* {@code WebRowSet} object will be populated
* @throws SQLException if a database access error occurs
*/
public void readXml(java.io.Reader reader) throws SQLException;
/**
* Reads a stream based XML input to populate this {@code WebRowSet}
* object.
*
* @param iStream the {@code java.io.InputStream} from which this
* {@code WebRowSet} object will be populated
* @throws SQLException if a data source access error occurs
* @throws IOException if an IO exception occurs
*/
public void readXml(java.io.InputStream iStream) throws SQLException, IOException;
/**
* Populates this {@code WebRowSet} object with
* the contents of the given {@code ResultSet} object and writes its
* data, properties, and metadata
* to the given {@code Writer} object in XML format.
* <p>
* NOTE: The {@code WebRowSet} cursor may be moved to write out the
* contents to the XML data source. If implemented in this way, the cursor <b>must</b>
* be returned to its position just prior to the {@code writeXml()} call.
*
* @param rs the {@code ResultSet} object with which to populate this
* {@code WebRowSet} object
* @param writer the {@code java.io.Writer} object to write to.
* @throws SQLException if an error occurs writing out the rowset
* contents in XML format
*/
public void writeXml(ResultSet rs, java.io.Writer writer) throws SQLException;
/**
* Populates this {@code WebRowSet} object with
* the contents of the given {@code ResultSet} object and writes its
* data, properties, and metadata
* to the given {@code OutputStream} object in XML format.
* <p>
* NOTE: The {@code WebRowSet} cursor may be moved to write out the
* contents to the XML data source. If implemented in this way, the cursor <b>must</b>
* be returned to its position just prior to the {@code writeXml()} call.
*
* @param rs the {@code ResultSet} object with which to populate this
* {@code WebRowSet} object
* @param oStream the {@code java.io.OutputStream} to write to
* @throws SQLException if a data source access error occurs
* @throws IOException if a IO exception occurs
*/
public void writeXml(ResultSet rs, java.io.OutputStream oStream) throws SQLException, IOException;
/**
* Writes the data, properties, and metadata for this {@code WebRowSet} object
* to the given {@code Writer} object in XML format.
*
* @param writer the {@code java.io.Writer} stream to write to
* @throws SQLException if an error occurs writing out the rowset
* contents to XML
*/
public void writeXml(java.io.Writer writer) throws SQLException;
/**
* Writes the data, properties, and metadata for this {@code WebRowSet} object
* to the given {@code OutputStream} object in XML format.
*
* @param oStream the {@code java.io.OutputStream} stream to write to
* @throws SQLException if a data source access error occurs
* @throws IOException if a IO exception occurs
*/
public void writeXml(java.io.OutputStream oStream) throws SQLException, IOException;
/**
* The public identifier for the XML Schema definition that defines the XML
* tags and their valid values for a {@code WebRowSet} implementation.
*/
public static String PUBLIC_XML_SCHEMA =
"--//Oracle Corporation//XSD Schema//EN";
/**
* The URL for the XML Schema definition file that defines the XML tags and
* their valid values for a {@code WebRowSet} implementation.
*/
public static String SCHEMA_SYSTEM_ID = "http://java.sun.com/xml/ns/jdbc/webrowset.xsd";
}

View file

@ -0,0 +1,297 @@
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<!--
Copyright (c) 2003, 2017, 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.
-->
<title>javax.sql.rowset Package</title>
</head>
<body>
<!-- Description clause -->
Standard interfaces and base classes for JDBC <code>RowSet</code>
implementations. This package contains interfaces and classes
that a standard <code>RowSet</code> implementation either implements or extends.
<h2>Table of Contents</h2>
<ul>
<li><a href="#pkgspec">1.0 Package Specification</a>
<li><a href="#stdrowset">2.0 Standard RowSet Definitions</a>
<li><a href="#impl">3.0 Implementer's Guide</a>
<li><a href="#relspec">4.0 Related Specifications</a>
<li><a href="#reldocs">5.0 Related Documentation</a>
</ul>
<h3><a id="pkgspec">1.0 Package Specification</a></h3>
This package specifies five standard JDBC <code>RowSet</code> interfaces.
All five extend the
<a href="../RowSet.html">RowSet</a> interface described in the JDBC 3.0
specification. It is anticipated that additional definitions
of more specialized JDBC <code>RowSet</code> types will emerge as this technology
matures. Future definitions <i>should</i> be specified as subinterfaces using
inheritance similar to the way it is used in this specification.
<p>
<i>Note:</i> The interface definitions provided in this package form the basis for
all compliant JDBC <code>RowSet</code> implementations. Vendors and more advanced
developers who intend to provide their own compliant <code>RowSet</code> implementations
should pay particular attention to the assertions detailed in specification
interfaces.
<h3><a id="stdrowset">2.0 Standard RowSet Definitions</a></h3>
<ul>
<li><a href="JdbcRowSet.html"><b><code>JdbcRowSet</code></b></a> - A wrapper around
a <code>ResultSet</code> object that makes it possible to use the result set as a
JavaBeans&trade; component. Thus,
a <code>JdbcRowSet</code> object can be a Bean that any tool
makes available for assembling an application as part of a component based
architecture. A <code>JdbcRowSet</code> object is a connected <code>RowSet</code>
object, that is, it
<b>must</b> continually maintain its connection to its data source using a JDBC
technology-enabled driver ("JDBC driver"). In addition, a <code>JdbcRowSet</code>
object provides a fully updatable and scrollable tabular
data structure as defined in the JDBC 3.0 specification.
<li><a href="CachedRowSet.html">
<b><code>CachedRowSet</code>&trade;</b></a>
- A <code>CachedRowSet</code> object is a JavaBeans&trade;
component that is scrollable, updatable, serializable, and generally disconnected from
the source of its data. A <code>CachedRowSet</code> object
typically contains rows from a result set, but it can also contain rows from any
file with a tabular format, such as a spreadsheet. <code>CachedRowSet</code> implementations
<b>must</b> use the <code>SyncFactory</code> to manage and obtain pluggable
<code>SyncProvider</code> objects to provide synchronization between the
disconnected <code>RowSet</code> object and the originating data source.
Typically a <code>SyncProvider</code> implementation relies upon a JDBC
driver to obtain connectivity to a particular data source.
Further details on this mechanism are discussed in the <a
href="spi/package-summary.html"><code>javax.sql.rowset.spi</code></a> package
specification.
<li><a href="WebRowSet.html"><b><code>WebRowSet</code></b></a> - A
<code>WebRowSet</code> object is an extension of <code>CachedRowSet</code>
that can read and write a <code>RowSet</code> object in a well formed XML format.
This class calls an <a href="spi/XmlReader.html"><code>XmlReader</code></a> object
(an extension of the <a href="../RowSetReader.html"><code>RowSetReader</code></a>
interface) to read a rowset in XML format. It calls an
<a href="spi/XmlWriter.html"><code>XmlWriter</code></a> object (an extension of the
<a href="../RowSetWriter.html"><code>RowSetWriter</code></a> interface)
to write a rowset in XML format. The reader and writer required by
<code>WebRowSet</code> objects are provided by the
<code>SyncFactory</code> in the form of <code>SyncProvider</code>
implementations. In order to ensure well formed XML usage, a standard generic XML
Schema is defined and published at
<a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">
<code>http://java.sun.com/xml/ns/jdbc/webrowset.xsd</code></a>.
<li><a href="FilteredRowSet.html"><b><code>FilteredRowSet</code></b></a> - A
<code>FilteredRowSet</code> object provides filtering functionality in a programmatic
and extensible way. There are many instances when a <code>RowSet</code> <code>object</code>
has a need to provide filtering in its contents without sacrificing the disconnected
environment, thus saving the expense of having to create a connection to the data source.
Solutions to this need vary from providing heavyweight full scale
SQL query abilities, to portable components, to more lightweight
approaches. A <code>FilteredRowSet</code> object consumes
an implementation of the <a href="Predicate.html"><code>Predicate</code></a>
interface, which <b>may</b> define a filter at run time. In turn, a
<code>FilteredRowSet</code> object is tasked with enforcing the set filter for both
inbound and outbound read and write operations. That is, all filters can be
considered as bi-directional. No standard filters are defined;
however, sufficient mechanics are specified to permit any required filter to be
implemented.
<li><a href="JoinRowSet.html"><b><code>JoinRowSet</code></b></a> - The <code>JoinRowSet</code>
interface describes a mechanism by which relationships can be established between
two or more standard <code>RowSet</code> implementations. Any number of <code>RowSet</code>
objects can be added to a <code>JoinRowSet</code> object provided the <code>RowSet</code>objects
can be related in a SQL <code>JOIN</code> like fashion. By definition, the SQL <code>JOIN</code>
statement is used to combine the data contained in two (<i>or more</i>) relational
database tables based upon a common attribute. By establishing and then enforcing
column matches, a <code>JoinRowSet</code> object establishes relationships between
<code>RowSet</code> instances without the need to touch the originating data source.
</ul>
<h3><a id="impl">3.0 Implementer's Guide</a></h3>
Compliant implementations of JDBC <code>RowSet</code> Implementations
<b>must</b> follow the assertions described in this specification. In accordance
with the terms of the <a href="http://www.jcp.org">Java Community Process</a>, a
Test Compatibility Kit (TCK) can be licensed to ensure compatibility with the
specification. The following paragraphs outline a number of starting points for
implementers of the standard JDBC <code>RowSet</code> definitions. Implementers
should also consult the <i>Implementer's Guide</i> in the <a
href="spi/package-summary.html">javax.sql.rowset.spi</a> package for guidelines
on <a href="spi/SyncProvider.html"><code>SyncProvider</code></a> implementations.
<ul>
<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 <b>may</b> extend the
<a href="BaseRowSet.html"><code>BaseRowSet</code></a> abstract class. For example, a
<code>CachedRowSet</code> implementation must implement the <code>CachedRowSet</code>
interface and extend the <code>BaseRowSet</code> abstract class. The
<code>BaseRowSet</code> class provides the standard architecture on which all
<code>RowSet</code> implementations should be built, regardless of whether the
<code>RowSet</code> objects exist in a connected or disconnected environment.
The <code>BaseRowSet</code> abstract class provides any <code>RowSet</code> implementation
with its base functionality, including property manipulation and event notification
that is fully compliant with <a href="http://java.sun.com/products/javabeans">JavaBeans</a>
component requirements. As an example, all implementations provided in the
reference implementations (contained in the <code>com.sun.rowset</code> package) use
the <code>BaseRowSet</code> class as a basis for their implementations.
<P>
The following table illustrates the features that the <code>BaseRowSet</code>
abstract class provides.
<blockquote>
<table class="striped" style="vertical-align:top; width:75%">
<caption>Features in <code>BaseRowSet</code></caption>
<thead>
<tr>
<th scope="col">Feature</th>
<th scope="col">Details</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Properties</th>
<td>Provides standard JavaBeans property manipulation
mechanisms to allow applications to get and set <code>RowSet</code> command and
property values. Refer to the documentation of the <code>javax.sql.RowSet</code>
interface (available in the JDBC 3.0 specification) for more details on
the standard <code>RowSet</code> properties.</td>
</tr>
<tr>
<th scope="row">Event notification</th>
<td>Provides standard JavaBeans event notifications
to registered event listeners. Refer to the documentation of <code>javax.sql.RowSetEvent</code>
interface (available in the JDBC 3.0 specification) for
more details on how to register and handle standard RowSet events generated
by compliant implementations.</td>
</tr>
<tr>
<th scope="row">Setters for a RowSet object's command</th>
<td>Provides a complete set of setter methods
for setting RowSet command parameters.</td>
</tr>
<tr>
<th scope="row">Streams</th>
<td>Provides fields for storing of stream instances
in addition to providing a set of constants for stream type designation.</td>
</tr>
</tbody>
</table>
</blockquote>
<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>
should ensure that this connection is provided solely by a JDBC driver.
Furthermore, <code>RowSet</code> objects that are implementations of the
<code>JdbcRowSet</code> interface and are therefore operating in a connected environment
do not use the <code>SyncFactory</code> to obtain a <code>RowSetReader</code> object
or a <code>RowSetWriter</code> object. They can safely rely on the JDBC driver to
supply their needs by virtue of the presence of an underlying updatable and scrollable
<code>ResultSet</code> implementation.
<li>
<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
connection management to a <code>SyncProvider</code> object provided by the
<code>SyncFactory</code>. To ensure fully disconnected semantics, all
disconnected <code>RowSet</code> objects <b>must</b> ensure
that the original connection made to the data source to populate the <code>RowSet</code>
object is closed to permit the garbage collector to recover and release resources. The
<code>SyncProvider</code> object ensures that the critical JDBC properties are
maintained in order to re-establish a connection to the data source when a
synchronization is required. A disconnected <code>RowSet</code> object should
therefore ensure that no
extraneous references remain on the <code>Connection</code> object.
<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
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.
<li><b>3.6 RowSetWarning Class</b>
<p>
The <code>RowSetWarning</code> class provides warnings that can be set
on <code>RowSet</code> implementations.
Similar to <a href="../../../java/sql/SQLWarning.html">SQLWarning</a> objects,
<code>RowSetWarning</code> objects are silently chained to the object whose method
caused the warning to be thrown. All <code>RowSet</code> implementations <b>should</b>
ensure that this chaining occurs if a warning is generated and also ensure that the
warnings are available via the <code>getRowSetWarnings</code> method defined in either
the <code>JdbcRowSet</code> interface or the <code>CachedRowSet</code> interface.
After a warning has been retrieved with one of the
<code>getRowSetWarnings</code> methods, the <code>RowSetWarning</code> method
<code>getNextWarning</code> can be called on it to retrieve any warnings that might
be chained on it. If a warning is returned, <code>getNextWarning</code> can be called
on it, and so on until there are no more warnings.
<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
<code>JoinRowSet</code> object in an SQL <code>JOIN</code> operation.
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.
</li>
<li><b>3.8 The RowSetFactory Interface</b>
<p>
A <code>RowSetFactory</code> implementation <strong>must</strong>
be provided.
</li>
</ul>
<h3><a id="relspec">4.0 Related Specifications</a></h3>
<ul>
<li><a href="https://jcp.org/en/jsr/detail?id=221">JDBC 4.3 Specification</a>
<li><a href="http://www.w3.org/XML/Schema">XML Schema</a>
</ul>
<h3><a id="reldocs">5.0 Related Documentation</a></h3>
<ul>
<li><a href="http://docs.oracle.com/javase/tutorial/jdbc/basics/rowset.html">
JDBC RowSet Tutorial</a>
</ul>
</body>
</html>

View file

@ -0,0 +1,12 @@
#Default JDBC RowSet sync providers listing
#
# Optimistic synchonriztaion provider
rowset.provider.classname.0=com.sun.rowset.providers.RIOptimisticProvider
rowset.provider.vendor.0=Oracle Corporation
rowset.provider.version.0=1.0
# XML Provider using standard XML schema
rowset.provider.classname.1=com.sun.rowset.providers.RIXMLProvider
rowset.provider.vendor.1=Oracle Corporation
rowset.provider.version.1=1.0

View file

@ -0,0 +1,671 @@
/*
* Copyright (c) 2003, 2014, 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.serial;
import java.sql.*;
import java.util.Arrays;
import java.util.Map;
import sun.reflect.misc.ReflectUtil;
/**
* An input stream used for custom mapping user-defined types (UDTs).
* An <code>SQLInputImpl</code> object is an input stream that contains a
* stream of values that are the attributes of a UDT.
* <p>
* This class is used by the driver behind the scenes when the method
* <code>getObject</code> is called on an SQL structured or distinct type
* that has a custom mapping; a programmer never invokes
* <code>SQLInputImpl</code> methods directly. They are provided here as a
* convenience for those who write <code>RowSet</code> implementations.
* <P>
* The <code>SQLInputImpl</code> class provides a set of
* reader methods analogous to the <code>ResultSet</code> getter
* methods. These methods make it possible to read the values in an
* <code>SQLInputImpl</code> object.
* <P>
* The method <code>wasNull</code> is used to determine whether the
* the last value read was SQL <code>NULL</code>.
* <P>When the method <code>getObject</code> is called with an
* object of a class implementing the interface <code>SQLData</code>,
* the JDBC driver calls the method <code>SQLData.getSQLType</code>
* to determine the SQL type of the UDT being custom mapped. The driver
* creates an instance of <code>SQLInputImpl</code>, populating it with the
* attributes of the UDT. The driver then passes the input
* stream to the method <code>SQLData.readSQL</code>, which in turn
* calls the <code>SQLInputImpl</code> reader methods
* to read the attributes from the input stream.
* @since 1.5
* @see java.sql.SQLData
*/
public class SQLInputImpl implements SQLInput {
/**
* <code>true</code> if the last value returned was <code>SQL NULL</code>;
* <code>false</code> otherwise.
*/
private boolean lastValueWasNull;
/**
* The current index into the array of SQL structured type attributes
* that will be read from this <code>SQLInputImpl</code> object and
* mapped to the fields of a class in the Java programming language.
*/
private int idx;
/**
* The array of attributes to be read from this stream. The order
* of the attributes is the same as the order in which they were
* listed in the SQL definition of the UDT.
*/
private Object attrib[];
/**
* The type map to use when the method <code>readObject</code>
* is invoked. This is a <code>java.util.Map</code> object in which
* there may be zero or more entries. Each entry consists of the
* fully qualified name of a UDT (the value to be mapped) and the
* <code>Class</code> object for a class that implements
* <code>SQLData</code> (the Java class that defines how the UDT
* will be mapped).
*/
private Map<String,Class<?>> map;
/**
* Creates an <code>SQLInputImpl</code> object initialized with the
* given array of attributes and the given type map. If any of the
* attributes is a UDT whose name is in an entry in the type map,
* the attribute will be mapped according to the corresponding
* <code>SQLData</code> implementation.
*
* @param attributes an array of <code>Object</code> instances in which
* each element is an attribute of a UDT. The order of the
* attributes in the array is the same order in which
* the attributes were defined in the UDT definition.
* @param map a <code>java.util.Map</code> object containing zero or more
* entries, with each entry consisting of 1) a <code>String</code>
* giving the fully
* qualified name of the UDT and 2) the <code>Class</code> object
* for the <code>SQLData</code> implementation that defines how
* the UDT is to be mapped
* @throws SQLException if the <code>attributes</code> or the <code>map</code>
* is a <code>null</code> value
*/
public SQLInputImpl(Object[] attributes, Map<String,Class<?>> map)
throws SQLException
{
if ((attributes == null) || (map == null)) {
throw new SQLException("Cannot instantiate a SQLInputImpl " +
"object with null parameters");
}
// assign our local reference to the attribute stream
attrib = Arrays.copyOf(attributes, attributes.length);
// init the index point before the head of the stream
idx = -1;
// set the map
this.map = map;
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object
* as an <code>Object</code> in the Java programming language.
*
* @return the next value in the input stream
* as an <code>Object</code> in the Java programming language
* @throws SQLException if the read position is located at an invalid
* position or if there are no further values in the stream
*/
private Object getNextAttribute() throws SQLException {
if (++idx >= attrib.length) {
throw new SQLException("SQLInputImpl exception: Invalid read " +
"position");
} else {
lastValueWasNull = attrib[idx] == null;
return attrib[idx];
}
}
//================================================================
// Methods for reading attributes from the stream of SQL data.
// These methods correspond to the column-accessor methods of
// java.sql.ResultSet.
//================================================================
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object as
* a <code>String</code> in the Java programming language.
* <p>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type; this responsibility is delegated
* to the UDT mapping as defined by a <code>SQLData</code>
* implementation.
*
* @return the next attribute in this <code>SQLInputImpl</code> object;
* if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position or if there are no further values in the stream.
*/
public String readString() throws SQLException {
return (String)getNextAttribute();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object as
* a <code>boolean</code> in the Java programming language.
* <p>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type; this responsibility is delegated
* to the UDT mapping as defined by a <code>SQLData</code>
* implementation.
*
* @return the next attribute in this <code>SQLInputImpl</code> object;
* if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position or if there are no further values in the stream.
*/
public boolean readBoolean() throws SQLException {
Boolean attrib = (Boolean)getNextAttribute();
return (attrib == null) ? false : attrib.booleanValue();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object as
* a <code>byte</code> in the Java programming language.
* <p>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type; this responsibility is delegated
* to the UDT mapping as defined by a <code>SQLData</code>
* implementation.
*
* @return the next attribute in this <code>SQLInputImpl</code> object;
* if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position or if there are no further values in the stream
*/
public byte readByte() throws SQLException {
Byte attrib = (Byte)getNextAttribute();
return (attrib == null) ? 0 : attrib.byteValue();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object
* as a <code>short</code> in the Java programming language.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type; this responsibility is delegated
* to the UDT mapping as defined by a <code>SQLData</code> implementation.
*
* @return the next attribute in this <code>SQLInputImpl</code> object;
* if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position or if there are no more values in the stream
*/
public short readShort() throws SQLException {
Short attrib = (Short)getNextAttribute();
return (attrib == null) ? 0 : attrib.shortValue();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object
* as an <code>int</code> in the Java programming language.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type; this responsibility is delegated
* to the UDT mapping as defined by a <code>SQLData</code> implementation.
*
* @return the next attribute in this <code>SQLInputImpl</code> object;
* if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position or if there are no more values in the stream
*/
public int readInt() throws SQLException {
Integer attrib = (Integer)getNextAttribute();
return (attrib == null) ? 0 : attrib.intValue();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object
* as a <code>long</code> in the Java programming language.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type; this responsibility is delegated
* to the UDT mapping as defined by a <code>SQLData</code> implementation.
*
* @return the next attribute in this <code>SQLInputImpl</code> object;
* if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position or if there are no more values in the stream
*/
public long readLong() throws SQLException {
Long attrib = (Long)getNextAttribute();
return (attrib == null) ? 0 : attrib.longValue();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object
* as a <code>float</code> in the Java programming language.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type; this responsibility is delegated
* to the UDT mapping as defined by a <code>SQLData</code> implementation.
*
* @return the next attribute in this <code>SQLInputImpl</code> object;
* if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position or if there are no more values in the stream
*/
public float readFloat() throws SQLException {
Float attrib = (Float)getNextAttribute();
return (attrib == null) ? 0 : attrib.floatValue();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object
* as a <code>double</code> in the Java programming language.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type; this responsibility is delegated
* to the UDT mapping as defined by a <code>SQLData</code> implementation.
*
* @return the next attribute in this <code>SQLInputImpl</code> object;
* if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position or if there are no more values in the stream
*/
public double readDouble() throws SQLException {
Double attrib = (Double)getNextAttribute();
return (attrib == null) ? 0 : attrib.doubleValue();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object
* as a <code>java.math.BigDecimal</code>.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type; this responsibility is delegated
* to the UDT mapping as defined by a <code>SQLData</code> implementation.
*
* @return the next attribute in this <code>SQLInputImpl</code> object;
* if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position or if there are no more values in the stream
*/
public java.math.BigDecimal readBigDecimal() throws SQLException {
return (java.math.BigDecimal)getNextAttribute();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object
* as an array of bytes.
* <p>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type; this responsibility is delegated
* to the UDT mapping as defined by a <code>SQLData</code> implementation.
*
* @return the next attribute in this <code>SQLInputImpl</code> object;
* if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position or if there are no more values in the stream
*/
public byte[] readBytes() throws SQLException {
return (byte[])getNextAttribute();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> as
* a <code>java.sql.Date</code> object.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type; this responsibility is delegated
* to the UDT mapping as defined by a <code>SQLData</code> implementation.
*
* @return the next attribute in this <code>SQLInputImpl</code> object;
* if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position or if there are no more values in the stream
*/
public java.sql.Date readDate() throws SQLException {
return (java.sql.Date)getNextAttribute();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object as
* a <code>java.sql.Time</code> object.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type as this responsibility is delegated
* to the UDT mapping as implemented by a <code>SQLData</code>
* implementation.
*
* @return the attribute; if the value is <code>SQL NULL</code>, return
* <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position; or if there are no further values in the stream.
*/
public java.sql.Time readTime() throws SQLException {
return (java.sql.Time)getNextAttribute();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object as
* a <code>java.sql.Timestamp</code> object.
*
* @return the attribute; if the value is <code>SQL NULL</code>, return
* <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position; or if there are no further values in the stream.
*/
public java.sql.Timestamp readTimestamp() throws SQLException {
return (java.sql.Timestamp)getNextAttribute();
}
/**
* Retrieves the next attribute in this <code>SQLInputImpl</code> object
* as a stream of Unicode characters.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type as this responsibility is delegated
* to the UDT mapping as implemented by a <code>SQLData</code>
* implementation.
*
* @return the attribute; if the value is <code>SQL NULL</code>, return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position; or if there are no further values in the stream.
*/
public java.io.Reader readCharacterStream() throws SQLException {
return (java.io.Reader)getNextAttribute();
}
/**
* Returns the next attribute in this <code>SQLInputImpl</code> object
* as a stream of ASCII characters.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type as this responsibility is delegated
* to the UDT mapping as implemented by a <code>SQLData</code>
* implementation.
*
* @return the attribute; if the value is <code>SQL NULL</code>,
* return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position; or if there are no further values in the stream.
*/
public java.io.InputStream readAsciiStream() throws SQLException {
return (java.io.InputStream)getNextAttribute();
}
/**
* Returns the next attribute in this <code>SQLInputImpl</code> object
* as a stream of uninterpreted bytes.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type as this responsibility is delegated
* to the UDT mapping as implemented by a <code>SQLData</code>
* implementation.
*
* @return the attribute; if the value is <code>SQL NULL</code>, return
* <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position; or if there are no further values in the stream.
*/
public java.io.InputStream readBinaryStream() throws SQLException {
return (java.io.InputStream)getNextAttribute();
}
//================================================================
// Methods for reading items of SQL user-defined types from the stream.
//================================================================
/**
* Retrieves the value at the head of this <code>SQLInputImpl</code>
* object as an <code>Object</code> in the Java programming language. The
* actual type of the object returned is determined by the default
* mapping of SQL types to types in the Java programming language unless
* there is a custom mapping, in which case the type of the object
* returned is determined by this stream's type map.
* <P>
* The JDBC technology-enabled driver registers a type map with the stream
* before passing the stream to the application.
* <P>
* When the datum at the head of the stream is an SQL <code>NULL</code>,
* this method returns <code>null</code>. If the datum is an SQL
* structured or distinct type with a custom mapping, this method
* determines the SQL type of the datum at the head of the stream,
* constructs an object of the appropriate class, and calls the method
* <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
* method then calls the appropriate <code>SQLInputImpl.readXXX</code>
* methods to retrieve the attribute values from the stream.
*
* @return the value at the head of the stream as an <code>Object</code>
* in the Java programming language; <code>null</code> if
* the value is SQL <code>NULL</code>
* @throws SQLException if the read position is located at an invalid
* position; or if there are no further values in the stream.
*/
public Object readObject() throws SQLException {
Object attrib = getNextAttribute();
if (attrib instanceof Struct) {
Struct s = (Struct)attrib;
// look up the class in the map
Class<?> c = map.get(s.getSQLTypeName());
if (c != null) {
// create new instance of the class
SQLData obj = null;
try {
ReflectUtil.checkPackageAccess(c);
@SuppressWarnings("deprecation")
Object tmp = c.newInstance();
obj = (SQLData)tmp;
} catch (Exception ex) {
throw new SQLException("Unable to Instantiate: ", ex);
}
// get the attributes from the struct
Object attribs[] = s.getAttributes(map);
// create the SQLInput "stream"
SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
// read the values...
obj.readSQL(sqlInput, s.getSQLTypeName());
return obj;
}
}
return attrib;
}
/**
* Retrieves the value at the head of this <code>SQLInputImpl</code> object
* as a <code>Ref</code> object in the Java programming language.
*
* @return a <code>Ref</code> object representing the SQL
* <code>REF</code> value at the head of the stream; if the value
* is <code>SQL NULL</code> return <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position; or if there are no further values in the stream.
*/
public Ref readRef() throws SQLException {
return (Ref)getNextAttribute();
}
/**
* Retrieves the <code>BLOB</code> value at the head of this
* <code>SQLInputImpl</code> object as a <code>Blob</code> object
* in the Java programming language.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type as this responsibility is delegated
* to the UDT mapping as implemented by a <code>SQLData</code>
* implementation.
*
* @return a <code>Blob</code> object representing the SQL
* <code>BLOB</code> value at the head of this stream;
* if the value is <code>SQL NULL</code>, return
* <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position; or if there are no further values in the stream.
*/
public Blob readBlob() throws SQLException {
return (Blob)getNextAttribute();
}
/**
* Retrieves the <code>CLOB</code> value at the head of this
* <code>SQLInputImpl</code> object as a <code>Clob</code> object
* in the Java programming language.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type as this responsibility is delegated
* to the UDT mapping as implemented by a <code>SQLData</code>
* implementation.
*
* @return a <code>Clob</code> object representing the SQL
* <code>CLOB</code> value at the head of the stream;
* if the value is <code>SQL NULL</code>, return
* <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position; or if there are no further values in the stream.
*/
public Clob readClob() throws SQLException {
return (Clob)getNextAttribute();
}
/**
* Reads an SQL <code>ARRAY</code> value from the stream and
* returns it as an <code>Array</code> object in the Java programming
* language.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type as this responsibility is delegated
* to the UDT mapping as implemented by a <code>SQLData</code>
* implementation.
*
* @return an <code>Array</code> object representing the SQL
* <code>ARRAY</code> value at the head of the stream; *
* if the value is <code>SQL NULL</code>, return
* <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position; or if there are no further values in the stream.
*/
public Array readArray() throws SQLException {
return (Array)getNextAttribute();
}
/**
* Ascertains whether the last value read from this
* <code>SQLInputImpl</code> object was <code>null</code>.
*
* @return <code>true</code> if the SQL value read most recently was
* <code>null</code>; otherwise, <code>false</code>; by default it
* will return false
* @throws SQLException if an error occurs determining the last value
* read was a <code>null</code> value or not;
*/
public boolean wasNull() throws SQLException {
return lastValueWasNull;
}
/**
* Reads an SQL <code>DATALINK</code> value from the stream and
* returns it as an <code>URL</code> object in the Java programming
* language.
* <P>
* This method does not perform type-safe checking to determine if the
* returned type is the expected type as this responsibility is delegated
* to the UDT mapping as implemented by a <code>SQLData</code>
* implementation.
*
* @return an <code>URL</code> object representing the SQL
* <code>DATALINK</code> value at the head of the stream; *
* if the value is <code>SQL NULL</code>, return
* <code>null</code>
* @throws SQLException if the read position is located at an invalid
* position; or if there are no further values in the stream.
*/
public java.net.URL readURL() throws SQLException {
return (java.net.URL)getNextAttribute();
}
//---------------------------- JDBC 4.0 -------------------------
/**
* Reads an SQL <code>NCLOB</code> value from the stream and returns it as a
* <code>Clob</code> object in the Java programming language.
*
* @return a <code>NClob</code> object representing data of the SQL <code>NCLOB</code> value
* at the head of the stream; <code>null</code> if the value read is
* SQL <code>NULL</code>
* @exception SQLException if a database access error occurs
* @since 1.6
*/
public NClob readNClob() throws SQLException {
return (NClob)getNextAttribute();
}
/**
* Reads the next attribute in the stream and returns it as a <code>String</code>
* in the Java programming language. It is intended for use when
* accessing <code>NCHAR</code>,<code>NVARCHAR</code>
* and <code>LONGNVARCHAR</code> columns.
*
* @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code>
* @exception SQLException if a database access error occurs
* @since 1.6
*/
public String readNString() throws SQLException {
return (String)getNextAttribute();
}
/**
* Reads an SQL <code>XML</code> value from the stream and returns it as a
* <code>SQLXML</code> object in the Java programming language.
*
* @return a <code>SQLXML</code> object representing data of the SQL <code>XML</code> value
* at the head of the stream; <code>null</code> if the value read is
* SQL <code>NULL</code>
* @exception SQLException if a database access error occurs
* @since 1.6
*/
public SQLXML readSQLXML() throws SQLException {
return (SQLXML)getNextAttribute();
}
/**
* Reads an SQL <code>ROWID</code> value from the stream and returns it as a
* <code>RowId</code> object in the Java programming language.
*
* @return a <code>RowId</code> object representing data of the SQL <code>ROWID</code> value
* at the head of the stream; <code>null</code> if the value read is
* SQL <code>NULL</code>
* @exception SQLException if a database access error occurs
* @since 1.6
*/
public RowId readRowId() throws SQLException {
return (RowId)getNextAttribute();
}
}

View file

@ -0,0 +1,646 @@
/*
* Copyright (c) 2003, 2013, 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.serial;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.*;
import java.util.Map;
import java.util.Vector;
/**
* The output stream for writing the attributes of a
* custom-mapped user-defined type (UDT) back to the database.
* The driver uses this interface internally, and its
* methods are never directly invoked by an application programmer.
* <p>
* When an application calls the
* method <code>PreparedStatement.setObject</code>, the driver
* checks to see whether the value to be written is a UDT with
* a custom mapping. If it is, there will be an entry in a
* type map containing the <code>Class</code> object for the
* class that implements <code>SQLData</code> for this UDT.
* If the value to be written is an instance of <code>SQLData</code>,
* the driver will create an instance of <code>SQLOutputImpl</code>
* and pass it to the method <code>SQLData.writeSQL</code>.
* The method <code>writeSQL</code> in turn calls the
* appropriate <code>SQLOutputImpl.writeXXX</code> methods
* to write data from the <code>SQLData</code> object to
* the <code>SQLOutputImpl</code> output stream as the
* representation of an SQL user-defined type.
*
* @since 1.5
*/
public class SQLOutputImpl implements SQLOutput {
/**
* A reference to an existing vector that
* contains the attributes of a <code>Struct</code> object.
*/
@SuppressWarnings("rawtypes")
private Vector attribs;
/**
* The type map the driver supplies to a newly created
* <code>SQLOutputImpl</code> object. This type map
* indicates the <code>SQLData</code> class whose
* <code>writeSQL</code> method will be called. This
* method will in turn call the appropriate
* <code>SQLOutputImpl</code> writer methods.
*/
@SuppressWarnings("rawtypes")
private Map map;
/**
* Creates a new <code>SQLOutputImpl</code> object
* initialized with the given vector of attributes and
* type map. The driver will use the type map to determine
* which <code>SQLData.writeSQL</code> method to invoke.
* This method will then call the appropriate
* <code>SQLOutputImpl</code> writer methods in order and
* thereby write the attributes to the new output stream.
*
* @param attributes a <code>Vector</code> object containing the attributes of
* the UDT to be mapped to one or more objects in the Java
* programming language
*
* @param map a <code>java.util.Map</code> object containing zero or
* more entries, with each entry consisting of 1) a <code>String</code>
* giving the fully qualified name of a UDT and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped
* @throws SQLException if the <code>attributes</code> or the <code>map</code>
* is a <code>null</code> value
*/
public SQLOutputImpl(Vector<?> attributes, Map<String,?> map)
throws SQLException
{
if ((attributes == null) || (map == null)) {
throw new SQLException("Cannot instantiate a SQLOutputImpl " +
"instance with null parameters");
}
this.attribs = attributes;
this.map = map;
}
//================================================================
// Methods for writing attributes to the stream of SQL data.
// These methods correspond to the column-accessor methods of
// java.sql.ResultSet.
//================================================================
/**
* Writes a <code>String</code> in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>CHAR</code>, <code>VARCHAR</code>, or
* <code>LONGVARCHAR</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeString(String x) throws SQLException {
//System.out.println("Adding :"+x);
attribs.add(x);
}
/**
* Writes a <code>boolean</code> in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>BIT</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeBoolean(boolean x) throws SQLException {
attribs.add(Boolean.valueOf(x));
}
/**
* Writes a <code>byte</code> in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>BIT</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeByte(byte x) throws SQLException {
attribs.add(Byte.valueOf(x));
}
/**
* Writes a <code>short</code> in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>SMALLINT</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeShort(short x) throws SQLException {
attribs.add(Short.valueOf(x));
}
/**
* Writes an <code>int</code> in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>INTEGER</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeInt(int x) throws SQLException {
attribs.add(Integer.valueOf(x));
}
/**
* Writes a <code>long</code> in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>BIGINT</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeLong(long x) throws SQLException {
attribs.add(Long.valueOf(x));
}
/**
* Writes a <code>float</code> in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>REAL</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeFloat(float x) throws SQLException {
attribs.add(Float.valueOf(x));
}
/**
* Writes a <code>double</code> in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>DOUBLE</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeDouble(double x) throws SQLException{
attribs.add(Double.valueOf(x));
}
/**
* Writes a <code>java.math.BigDecimal</code> object in the Java programming
* language to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>NUMERIC</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeBigDecimal(java.math.BigDecimal x) throws SQLException{
attribs.add(x);
}
/**
* Writes an array of <code>bytes</code> in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>VARBINARY</code> or <code>LONGVARBINARY</code>
* before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeBytes(byte[] x) throws SQLException {
attribs.add(x);
}
/**
* Writes a <code>java.sql.Date</code> object in the Java programming
* language to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>DATE</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeDate(java.sql.Date x) throws SQLException {
attribs.add(x);
}
/**
* Writes a <code>java.sql.Time</code> object in the Java programming
* language to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>TIME</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeTime(java.sql.Time x) throws SQLException {
attribs.add(x);
}
/**
* Writes a <code>java.sql.Timestamp</code> object in the Java programming
* language to this <code>SQLOutputImpl</code> object. The driver converts
* it to an SQL <code>TIMESTAMP</code> before returning it to the database.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeTimestamp(java.sql.Timestamp x) throws SQLException {
attribs.add(x);
}
/**
* Writes a stream of Unicode characters to this
* <code>SQLOutputImpl</code> object. The driver will do any necessary
* conversion from Unicode to the database <code>CHAR</code> format.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeCharacterStream(java.io.Reader x) throws SQLException {
BufferedReader bufReader = new BufferedReader(x);
try {
int i;
while( (i = bufReader.read()) != -1 ) {
char ch = (char)i;
StringBuffer strBuf = new StringBuffer();
strBuf.append(ch);
String str = new String(strBuf);
String strLine = bufReader.readLine();
writeString(str.concat(strLine));
}
} catch(IOException ioe) {
}
}
/**
* Writes a stream of ASCII characters to this
* <code>SQLOutputImpl</code> object. The driver will do any necessary
* conversion from ASCII to the database <code>CHAR</code> format.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeAsciiStream(java.io.InputStream x) throws SQLException {
BufferedReader bufReader = new BufferedReader(new InputStreamReader(x));
try {
int i;
while( (i=bufReader.read()) != -1 ) {
char ch = (char)i;
StringBuffer strBuf = new StringBuffer();
strBuf.append(ch);
String str = new String(strBuf);
String strLine = bufReader.readLine();
writeString(str.concat(strLine));
}
}catch(IOException ioe) {
throw new SQLException(ioe.getMessage());
}
}
/**
* Writes a stream of uninterpreted bytes to this <code>SQLOutputImpl</code>
* object.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeBinaryStream(java.io.InputStream x) throws SQLException {
BufferedReader bufReader = new BufferedReader(new InputStreamReader(x));
try {
int i;
while( (i=bufReader.read()) != -1 ) {
char ch = (char)i;
StringBuffer strBuf = new StringBuffer();
strBuf.append(ch);
String str = new String(strBuf);
String strLine = bufReader.readLine();
writeString(str.concat(strLine));
}
} catch(IOException ioe) {
throw new SQLException(ioe.getMessage());
}
}
//================================================================
// Methods for writing items of SQL user-defined types to the stream.
// These methods pass objects to the database as values of SQL
// Structured Types, Distinct Types, Constructed Types, and Locator
// Types. They decompose the Java object(s) and write leaf data
// items using the methods above.
//================================================================
/**
* Writes to the stream the data contained in the given
* <code>SQLData</code> object.
* When the <code>SQLData</code> object is <code>null</code>, this
* method writes an SQL <code>NULL</code> to the stream.
* Otherwise, it calls the <code>SQLData.writeSQL</code>
* method of the given object, which
* writes the object's attributes to the stream.
* <P>
* The implementation of the method <code>SQLData.writeSQ</code>
* calls the appropriate <code>SQLOutputImpl.writeXXX</code> method(s)
* for writing each of the object's attributes in order.
* The attributes must be read from an <code>SQLInput</code>
* input stream and written to an <code>SQLOutputImpl</code>
* output stream in the same order in which they were
* listed in the SQL definition of the user-defined type.
*
* @param x the object representing data of an SQL structured or
* distinct type
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeObject(SQLData x) throws SQLException {
/*
* Except for the types that are passed as objects
* this seems to be the only way for an object to
* get a null value for a field in a structure.
*
* Note: this means that the class defining SQLData
* will need to track if a field is SQL null for itself
*/
if (x == null) {
attribs.add(null);
} else {
/*
* We have to write out a SerialStruct that contains
* the name of this class otherwise we don't know
* what to re-instantiate during readSQL()
*/
attribs.add(new SerialStruct(x, map));
}
}
/**
* Writes a <code>Ref</code> object in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to a serializable <code>SerialRef</code> SQL <code>REF</code> value
* before returning it to the database.
*
* @param x an object representing an SQL <code>REF</code> value
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeRef(Ref x) throws SQLException {
if (x == null) {
attribs.add(null);
} else {
attribs.add(new SerialRef(x));
}
}
/**
* Writes a <code>Blob</code> object in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to a serializable <code>SerialBlob</code> SQL <code>BLOB</code> value
* before returning it to the database.
*
* @param x an object representing an SQL <code>BLOB</code> value
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeBlob(Blob x) throws SQLException {
if (x == null) {
attribs.add(null);
} else {
attribs.add(new SerialBlob(x));
}
}
/**
* Writes a <code>Clob</code> object in the Java programming language
* to this <code>SQLOutputImpl</code> object. The driver converts
* it to a serializable <code>SerialClob</code> SQL <code>CLOB</code> value
* before returning it to the database.
*
* @param x an object representing an SQL <code>CLOB</code> value
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeClob(Clob x) throws SQLException {
if (x == null) {
attribs.add(null);
} else {
attribs.add(new SerialClob(x));
}
}
/**
* Writes a <code>Struct</code> object in the Java
* programming language to this <code>SQLOutputImpl</code>
* object. The driver converts this value to an SQL structured type
* before returning it to the database.
* <P>
* This method should be used when an SQL structured type has been
* mapped to a <code>Struct</code> object in the Java programming
* language (the standard mapping). The method
* <code>writeObject</code> should be used if an SQL structured type
* has been custom mapped to a class in the Java programming language.
*
* @param x an object representing the attributes of an SQL structured type
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeStruct(Struct x) throws SQLException {
SerialStruct s = new SerialStruct(x,map);;
attribs.add(s);
}
/**
* Writes an <code>Array</code> object in the Java
* programming language to this <code>SQLOutputImpl</code>
* object. The driver converts this value to a serializable
* <code>SerialArray</code> SQL <code>ARRAY</code>
* value before returning it to the database.
*
* @param x an object representing an SQL <code>ARRAY</code> value
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeArray(Array x) throws SQLException {
if (x == null) {
attribs.add(null);
} else {
attribs.add(new SerialArray(x, map));
}
}
/**
* Writes an <code>java.sql.Type.DATALINK</code> object in the Java
* programming language to this <code>SQLOutputImpl</code> object. The
* driver converts this value to a serializable <code>SerialDatalink</code>
* SQL <code>DATALINK</code> value before return it to the database.
*
* @param url an object representing a SQL <code>DATALINK</code> value
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeURL(java.net.URL url) throws SQLException {
if (url == null) {
attribs.add(null);
} else {
attribs.add(new SerialDatalink(url));
}
}
/**
* Writes the next attribute to the stream as a <code>String</code>
* in the Java programming language. The driver converts this to a
* SQL <code>NCHAR</code> or
* <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value
* (depending on the argument's
* size relative to the driver's limits on <code>NVARCHAR</code> values)
* when it sends it to the stream.
*
* @param x the value to pass to the database
* @exception SQLException if a database access error occurs
* @since 1.6
*/
@SuppressWarnings("unchecked")
public void writeNString(String x) throws SQLException {
attribs.add(x);
}
/**
* Writes an SQL <code>NCLOB</code> value to the stream.
*
* @param x a <code>NClob</code> object representing data of an SQL
* <code>NCLOB</code> value
*
* @exception SQLException if a database access error occurs
* @since 1.6
*/
@SuppressWarnings("unchecked")
public void writeNClob(NClob x) throws SQLException {
attribs.add(x);
}
/**
* Writes an SQL <code>ROWID</code> value to the stream.
*
* @param x a <code>RowId</code> object representing data of an SQL
* <code>ROWID</code> value
*
* @exception SQLException if a database access error occurs
* @since 1.6
*/
@SuppressWarnings("unchecked")
public void writeRowId(RowId x) throws SQLException {
attribs.add(x);
}
/**
* Writes an SQL <code>XML</code> value to the stream.
*
* @param x a <code>SQLXML</code> object representing data of an SQL
* <code>XML</code> value
*
* @exception SQLException if a database access error occurs
* @since 1.6
*/
@SuppressWarnings("unchecked")
public void writeSQLXML(SQLXML x) throws SQLException {
attribs.add(x);
}
}

View file

@ -0,0 +1,660 @@
/*
* Copyright (c) 2003, 2014, 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.serial;
import java.sql.*;
import java.io.*;
import java.util.Map;
import java.net.URL;
import java.util.Arrays;
/**
* A serialized version of an <code>Array</code>
* object, which is the mapping in the Java programming language of an SQL
* <code>ARRAY</code> value.
* <P>
* The <code>SerialArray</code> class provides a constructor for creating
* a <code>SerialArray</code> instance from an <code>Array</code> object,
* methods for getting the base type and the SQL name for the base type, and
* methods for copying all or part of a <code>SerialArray</code> object.
* <P>
*
* Note: In order for this class to function correctly, a connection to the
* data source
* must be available in order for the SQL <code>Array</code> object to be
* materialized (have all of its elements brought to the client server)
* if necessary. At this time, logical pointers to the data in the data source,
* such as locators, are not currently supported.
*
* <h3> Thread safety </h3>
*
* A SerialArray is not safe for use by multiple concurrent threads. If a
* SerialArray is to be used by more than one thread then access to the
* SerialArray should be controlled by appropriate synchronization.
*
* @since 1.5
*/
public class SerialArray implements Array, Serializable, Cloneable {
/**
* A serialized array in which each element is an <code>Object</code>
* in the Java programming language that represents an element
* in the SQL <code>ARRAY</code> value.
* @serial
*/
private Object[] elements;
/**
* The SQL type of the elements in this <code>SerialArray</code> object. The
* type is expressed as one of the constants from the class
* <code>java.sql.Types</code>.
* @serial
*/
private int baseType;
/**
* The type name used by the DBMS for the elements in the SQL <code>ARRAY</code>
* value that this <code>SerialArray</code> object represents.
* @serial
*/
private String baseTypeName;
/**
* The number of elements in this <code>SerialArray</code> object, which
* is also the number of elements in the SQL <code>ARRAY</code> value
* that this <code>SerialArray</code> object represents.
* @serial
*/
private int len;
/**
* Constructs a new <code>SerialArray</code> object from the given
* <code>Array</code> object, using the given type map for the custom
* mapping of each element when the elements are SQL UDTs.
* <P>
* This method does custom mapping if the array elements are a UDT
* and the given type map has an entry for that UDT.
* Custom mapping is recursive,
* meaning that if, for instance, an element of an SQL structured type
* is an SQL structured type that itself has an element that is an SQL
* structured type, each structured type that has a custom mapping will be
* mapped according to the given type map.
* <P>
* The new <code>SerialArray</code>
* object contains the same elements as the <code>Array</code> object
* from which it is built, except when the base type is the SQL type
* <code>STRUCT</code>, <code>ARRAY</code>, <code>BLOB</code>,
* <code>CLOB</code>, <code>DATALINK</code> or <code>JAVA_OBJECT</code>.
* In this case, each element in the new
* <code>SerialArray</code> object is the appropriate serialized form,
* that is, a <code>SerialStruct</code>, <code>SerialArray</code>,
* <code>SerialBlob</code>, <code>SerialClob</code>,
* <code>SerialDatalink</code>, or <code>SerialJavaObject</code> object.
* <P>
* Note: (1) The <code>Array</code> object from which a <code>SerialArray</code>
* object is created must have materialized the SQL <code>ARRAY</code> value's
* data on the client before it is passed to the constructor. Otherwise,
* the new <code>SerialArray</code> object will contain no data.
* <p>
* Note: (2) If the <code>Array</code> contains <code>java.sql.Types.JAVA_OBJECT</code>
* types, the <code>SerialJavaObject</code> constructor is called where checks
* are made to ensure this object is serializable.
* <p>
* Note: (3) The <code>Array</code> object supplied to this constructor cannot
* return <code>null</code> for any <code>Array.getArray()</code> methods.
* <code>SerialArray</code> cannot serialize null array values.
*
*
* @param array the <code>Array</code> object to be serialized
* @param map a <code>java.util.Map</code> object in which
* each entry consists of 1) a <code>String</code> object
* giving the fully qualified name of a UDT (an SQL structured type or
* distinct type) and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped. The <i>map</i>
* parameter does not have any effect for <code>Blob</code>,
* <code>Clob</code>, <code>DATALINK</code>, or
* <code>JAVA_OBJECT</code> types.
* @throws SerialException if an error occurs serializing the
* <code>Array</code> object
* @throws SQLException if a database access error occurs or if the
* <i>array</i> or the <i>map</i> values are <code>null</code>
*/
public SerialArray(Array array, Map<String,Class<?>> map)
throws SerialException, SQLException
{
if ((array == null) || (map == null)) {
throw new SQLException("Cannot instantiate a SerialArray " +
"object with null parameters");
}
if ((elements = (Object[])array.getArray()) == null) {
throw new SQLException("Invalid Array object. Calls to Array.getArray() " +
"return null value which cannot be serialized");
}
elements = (Object[])array.getArray(map);
baseType = array.getBaseType();
baseTypeName = array.getBaseTypeName();
len = elements.length;
switch (baseType) {
case java.sql.Types.STRUCT:
for (int i = 0; i < len; i++) {
elements[i] = new SerialStruct((Struct)elements[i], map);
}
break;
case java.sql.Types.ARRAY:
for (int i = 0; i < len; i++) {
elements[i] = new SerialArray((Array)elements[i], map);
}
break;
case java.sql.Types.BLOB:
for (int i = 0; i < len; i++) {
elements[i] = new SerialBlob((Blob)elements[i]);
}
break;
case java.sql.Types.CLOB:
for (int i = 0; i < len; i++) {
elements[i] = new SerialClob((Clob)elements[i]);
}
break;
case java.sql.Types.DATALINK:
for (int i = 0; i < len; i++) {
elements[i] = new SerialDatalink((URL)elements[i]);
}
break;
case java.sql.Types.JAVA_OBJECT:
for (int i = 0; i < len; i++) {
elements[i] = new SerialJavaObject(elements[i]);
}
}
}
/**
* This method frees the {@code SerialArray} object and releases the
* resources that it holds. The object is invalid once the {@code free}
* method is called. <p> If {@code free} is called multiple times, the
* subsequent calls to {@code free} are treated as a no-op. </P>
*
* @throws SQLException if an error occurs releasing the SerialArray's resources
* @since 1.6
*/
public void free() throws SQLException {
if (elements != null) {
elements = null;
baseTypeName= null;
}
}
/**
* Constructs a new <code>SerialArray</code> object from the given
* <code>Array</code> object.
* <P>
* This constructor does not do custom mapping. If the base type of the array
* is an SQL structured type and custom mapping is desired, the constructor
* <code>SerialArray(Array array, Map map)</code> should be used.
* <P>
* The new <code>SerialArray</code>
* object contains the same elements as the <code>Array</code> object
* from which it is built, except when the base type is the SQL type
* <code>BLOB</code>,
* <code>CLOB</code>, <code>DATALINK</code> or <code>JAVA_OBJECT</code>.
* In this case, each element in the new
* <code>SerialArray</code> object is the appropriate serialized form,
* that is, a <code>SerialBlob</code>, <code>SerialClob</code>,
* <code>SerialDatalink</code>, or <code>SerialJavaObject</code> object.
* <P>
* Note: (1) The <code>Array</code> object from which a <code>SerialArray</code>
* object is created must have materialized the SQL <code>ARRAY</code> value's
* data on the client before it is passed to the constructor. Otherwise,
* the new <code>SerialArray</code> object will contain no data.
* <p>
* Note: (2) The <code>Array</code> object supplied to this constructor cannot
* return <code>null</code> for any <code>Array.getArray()</code> methods.
* <code>SerialArray</code> cannot serialize <code>null</code> array values.
*
* @param array the <code>Array</code> object to be serialized
* @throws SerialException if an error occurs serializing the
* <code>Array</code> object
* @throws SQLException if a database access error occurs or the
* <i>array</i> parameter is <code>null</code>.
*/
public SerialArray(Array array) throws SerialException, SQLException {
if (array == null) {
throw new SQLException("Cannot instantiate a SerialArray " +
"object with a null Array object");
}
if ((elements = (Object[])array.getArray()) == null) {
throw new SQLException("Invalid Array object. Calls to Array.getArray() " +
"return null value which cannot be serialized");
}
//elements = (Object[])array.getArray();
baseType = array.getBaseType();
baseTypeName = array.getBaseTypeName();
len = elements.length;
switch (baseType) {
case java.sql.Types.BLOB:
for (int i = 0; i < len; i++) {
elements[i] = new SerialBlob((Blob)elements[i]);
}
break;
case java.sql.Types.CLOB:
for (int i = 0; i < len; i++) {
elements[i] = new SerialClob((Clob)elements[i]);
}
break;
case java.sql.Types.DATALINK:
for (int i = 0; i < len; i++) {
elements[i] = new SerialDatalink((URL)elements[i]);
}
break;
case java.sql.Types.JAVA_OBJECT:
for (int i = 0; i < len; i++) {
elements[i] = new SerialJavaObject(elements[i]);
}
break;
}
}
/**
* Returns a new array that is a copy of this <code>SerialArray</code>
* object.
*
* @return a copy of this <code>SerialArray</code> object as an
* <code>Object</code> in the Java programming language
* @throws SerialException if an error occurs;
* if {@code free} had previously been called on this object
*/
public Object getArray() throws SerialException {
isValid();
Object dst = new Object[len];
System.arraycopy((Object)elements, 0, dst, 0, len);
return dst;
}
/**
* Returns a new array that is a copy of this <code>SerialArray</code>
* object, using the given type map for the custom
* mapping of each element when the elements are SQL UDTs.
* <P>
* This method does custom mapping if the array elements are a UDT
* and the given type map has an entry for that UDT.
* Custom mapping is recursive,
* meaning that if, for instance, an element of an SQL structured type
* is an SQL structured type that itself has an element that is an SQL
* structured type, each structured type that has a custom mapping will be
* mapped according to the given type map.
*
* @param map a <code>java.util.Map</code> object in which
* each entry consists of 1) a <code>String</code> object
* giving the fully qualified name of a UDT and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped
* @return a copy of this <code>SerialArray</code> object as an
* <code>Object</code> in the Java programming language
* @throws SerialException if an error occurs;
* if {@code free} had previously been called on this object
*/
public Object getArray(Map<String, Class<?>> map) throws SerialException {
isValid();
Object dst[] = new Object[len];
System.arraycopy((Object)elements, 0, dst, 0, len);
return dst;
}
/**
* Returns a new array that is a copy of a slice
* of this <code>SerialArray</code> object, starting with the
* element at the given index and containing the given number
* of consecutive elements.
*
* @param index the index into this <code>SerialArray</code> object
* of the first element to be copied;
* the index of the first element is <code>0</code>
* @param count the number of consecutive elements to be copied, starting
* at the given index
* @return a copy of the designated elements in this <code>SerialArray</code>
* object as an <code>Object</code> in the Java programming language
* @throws SerialException if an error occurs;
* if {@code free} had previously been called on this object
*/
public Object getArray(long index, int count) throws SerialException {
isValid();
Object dst = new Object[count];
System.arraycopy((Object)elements, (int)index, dst, 0, count);
return dst;
}
/**
* Returns a new array that is a copy of a slice
* of this <code>SerialArray</code> object, starting with the
* element at the given index and containing the given number
* of consecutive elements.
* <P>
* This method does custom mapping if the array elements are a UDT
* and the given type map has an entry for that UDT.
* Custom mapping is recursive,
* meaning that if, for instance, an element of an SQL structured type
* is an SQL structured type that itself has an element that is an SQL
* structured type, each structured type that has a custom mapping will be
* mapped according to the given type map.
*
* @param index the index into this <code>SerialArray</code> object
* of the first element to be copied; the index of the
* first element in the array is <code>0</code>
* @param count the number of consecutive elements to be copied, starting
* at the given index
* @param map a <code>java.util.Map</code> object in which
* each entry consists of 1) a <code>String</code> object
* giving the fully qualified name of a UDT and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped
* @return a copy of the designated elements in this <code>SerialArray</code>
* object as an <code>Object</code> in the Java programming language
* @throws SerialException if an error occurs;
* if {@code free} had previously been called on this object
*/
public Object getArray(long index, int count, Map<String,Class<?>> map)
throws SerialException
{
isValid();
Object dst = new Object[count];
System.arraycopy((Object)elements, (int)index, dst, 0, count);
return dst;
}
/**
* Retrieves the SQL type of the elements in this <code>SerialArray</code>
* object. The <code>int</code> returned is one of the constants in the class
* <code>java.sql.Types</code>.
*
* @return one of the constants in <code>java.sql.Types</code>, indicating
* the SQL type of the elements in this <code>SerialArray</code> object
* @throws SerialException if an error occurs;
* if {@code free} had previously been called on this object
*/
public int getBaseType() throws SerialException {
isValid();
return baseType;
}
/**
* Retrieves the DBMS-specific type name for the elements in this
* <code>SerialArray</code> object.
*
* @return the SQL type name used by the DBMS for the base type of this
* <code>SerialArray</code> object
* @throws SerialException if an error occurs;
* if {@code free} had previously been called on this object
*/
public String getBaseTypeName() throws SerialException {
isValid();
return baseTypeName;
}
/**
* Retrieves a <code>ResultSet</code> object holding the elements of
* the subarray that starts at
* index <i>index</i> and contains up to <i>count</i> successive elements.
* This method uses the connection's type map to map the elements of
* the array if the map contains
* an entry for the base type. Otherwise, the standard mapping is used.
*
* @param index the index into this <code>SerialArray</code> object
* of the first element to be copied; the index of the
* first element in the array is <code>0</code>
* @param count the number of consecutive elements to be copied, starting
* at the given index
* @return a <code>ResultSet</code> object containing the designated
* elements in this <code>SerialArray</code> object, with a
* separate row for each element
* @throws SerialException if called with the cause set to
* {@code UnsupportedOperationException}
*/
public ResultSet getResultSet(long index, int count) throws SerialException {
SerialException se = new SerialException();
se.initCause(new UnsupportedOperationException());
throw se;
}
/**
*
* Retrieves a <code>ResultSet</code> object that contains all of
* the elements of the SQL <code>ARRAY</code>
* value represented by this <code>SerialArray</code> object. This method uses
* the specified map for type map customizations unless the base type of the
* array does not match a user-defined type (UDT) in <i>map</i>, in
* which case it uses the
* standard mapping. This version of the method <code>getResultSet</code>
* uses either the given type map or the standard mapping; it never uses the
* type map associated with the connection.
*
* @param map a <code>java.util.Map</code> object in which
* each entry consists of 1) a <code>String</code> object
* giving the fully qualified name of a UDT and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped
* @return a <code>ResultSet</code> object containing all of the
* elements in this <code>SerialArray</code> object, with a
* separate row for each element
* @throws SerialException if called with the cause set to
* {@code UnsupportedOperationException}
*/
public ResultSet getResultSet(Map<String, Class<?>> map)
throws SerialException
{
SerialException se = new SerialException();
se.initCause(new UnsupportedOperationException());
throw se;
}
/**
* Retrieves a <code>ResultSet</code> object that contains all of
* the elements in the <code>ARRAY</code> value that this
* <code>SerialArray</code> object represents.
* If appropriate, the elements of the array are mapped using the connection's
* type map; otherwise, the standard mapping is used.
*
* @return a <code>ResultSet</code> object containing all of the
* elements in this <code>SerialArray</code> object, with a
* separate row for each element
* @throws SerialException if called with the cause set to
* {@code UnsupportedOperationException}
*/
public ResultSet getResultSet() throws SerialException {
SerialException se = new SerialException();
se.initCause(new UnsupportedOperationException());
throw se;
}
/**
* Retrieves a result set holding the elements of the subarray that starts at
* Retrieves a <code>ResultSet</code> object that contains a subarray of the
* elements in this <code>SerialArray</code> object, starting at
* index <i>index</i> and containing up to <i>count</i> successive
* elements. This method uses
* the specified map for type map customizations unless the base type of the
* array does not match a user-defined type (UDT) in <i>map</i>, in
* which case it uses the
* standard mapping. This version of the method <code>getResultSet</code> uses
* either the given type map or the standard mapping; it never uses the type
* map associated with the connection.
*
* @param index the index into this <code>SerialArray</code> object
* of the first element to be copied; the index of the
* first element in the array is <code>0</code>
* @param count the number of consecutive elements to be copied, starting
* at the given index
* @param map a <code>java.util.Map</code> object in which
* each entry consists of 1) a <code>String</code> object
* giving the fully qualified name of a UDT and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped
* @return a <code>ResultSet</code> object containing the designated
* elements in this <code>SerialArray</code> object, with a
* separate row for each element
* @throws SerialException if called with the cause set to
* {@code UnsupportedOperationException}
*/
public ResultSet getResultSet(long index, int count,
Map<String,Class<?>> map)
throws SerialException
{
SerialException se = new SerialException();
se.initCause(new UnsupportedOperationException());
throw se;
}
/**
* Compares this SerialArray to the specified object. The result is {@code
* true} if and only if the argument is not {@code null} and is a {@code
* SerialArray} object whose elements are identical to this object's elements
*
* @param obj The object to compare this {@code SerialArray} against
*
* @return {@code true} if the given object represents a {@code SerialArray}
* equivalent to this SerialArray, {@code false} otherwise
*
*/
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SerialArray) {
SerialArray sa = (SerialArray)obj;
return baseType == sa.baseType &&
baseTypeName.equals(sa.baseTypeName) &&
Arrays.equals(elements, sa.elements);
}
return false;
}
/**
* Returns a hash code for this SerialArray. The hash code for a
* {@code SerialArray} object is computed using the hash codes
* of the elements of the {@code SerialArray} object
*
* @return a hash code value for this object.
*/
public int hashCode() {
return (((31 + Arrays.hashCode(elements)) * 31 + len) * 31 +
baseType) * 31 + baseTypeName.hashCode();
}
/**
* Returns a clone of this {@code SerialArray}. The copy will contain a
* reference to a clone of the underlying objects array, not a reference
* to the original underlying object array of this {@code SerialArray} object.
*
* @return a clone of this SerialArray
*/
public Object clone() {
try {
SerialArray sa = (SerialArray) super.clone();
sa.elements = (elements != null) ? Arrays.copyOf(elements, len) : null;
return sa;
} catch (CloneNotSupportedException ex) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
}
/**
* readObject is called to restore the state of the {@code SerialArray} from
* a stream.
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField fields = s.readFields();
Object[] tmp = (Object[])fields.get("elements", null);
if (tmp == null)
throw new InvalidObjectException("elements is null and should not be!");
elements = tmp.clone();
len = fields.get("len", 0);
if(elements.length != len)
throw new InvalidObjectException("elements is not the expected size");
baseType = fields.get("baseType", 0);
baseTypeName = (String)fields.get("baseTypeName", null);
}
/**
* writeObject is called to save the state of the {@code SerialArray}
* to a stream.
*/
private void writeObject(ObjectOutputStream s)
throws IOException, ClassNotFoundException {
ObjectOutputStream.PutField fields = s.putFields();
fields.put("elements", elements);
fields.put("len", len);
fields.put("baseType", baseType);
fields.put("baseTypeName", baseTypeName);
s.writeFields();
}
/**
* Check to see if this object had previously had its {@code free} method
* called
*
* @throws SerialException
*/
private void isValid() throws SerialException {
if (elements == null) {
throw new SerialException("Error: You cannot call a method on a "
+ "SerialArray instance once free() has been called.");
}
}
/**
* The identifier that assists in the serialization of this <code>SerialArray</code>
* object.
*/
static final long serialVersionUID = -8466174297270688520L;
}

View file

@ -0,0 +1,603 @@
/*
* Copyright (c) 2003, 2015, 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.serial;
import java.sql.*;
import java.io.*;
import java.lang.reflect.*;
import java.util.Arrays;
/**
* A serialized mapping in the Java programming language of an SQL
* <code>BLOB</code> value.
* <P>
* The <code>SerialBlob</code> class provides a constructor for creating
* an instance from a <code>Blob</code> object. Note that the
* <code>Blob</code>
* object should have brought the SQL <code>BLOB</code> value's data over
* to the client before a <code>SerialBlob</code> object
* is constructed from it. The data of an SQL <code>BLOB</code> value can
* be materialized on the client as an array of bytes (using the method
* <code>Blob.getBytes</code>) or as a stream of uninterpreted bytes
* (using the method <code>Blob.getBinaryStream</code>).
* <P>
* <code>SerialBlob</code> methods make it possible to make a copy of a
* <code>SerialBlob</code> object as an array of bytes or as a stream.
* They also make it possible to locate a given pattern of bytes or a
* <code>Blob</code> object within a <code>SerialBlob</code> object
* and to update or truncate a <code>Blob</code> object.
*
* <h3> Thread safety </h3>
*
* <p> A SerialBlob is not safe for use by multiple concurrent threads. If a
* SerialBlob is to be used by more than one thread then access to the SerialBlob
* should be controlled by appropriate synchronization.
*
* @author Jonathan Bruce
* @since 1.5
*/
public class SerialBlob implements Blob, Serializable, Cloneable {
/**
* A serialized array of uninterpreted bytes representing the
* value of this <code>SerialBlob</code> object.
* @serial
*/
private byte[] buf;
/**
* The internal representation of the <code>Blob</code> object on which this
* <code>SerialBlob</code> object is based.
*/
private Blob blob;
/**
* The number of bytes in this <code>SerialBlob</code> object's
* array of bytes.
* @serial
*/
private long len;
/**
* The original number of bytes in this <code>SerialBlob</code> object's
* array of bytes when it was first established.
* @serial
*/
private long origLen;
/**
* Constructs a <code>SerialBlob</code> object that is a serialized version of
* the given <code>byte</code> array.
* <p>
* The new <code>SerialBlob</code> object is initialized with the data from the
* <code>byte</code> array, thus allowing disconnected <code>RowSet</code>
* objects to establish serialized <code>Blob</code> objects without
* touching the data source.
*
* @param b the <code>byte</code> array containing the data for the
* <code>Blob</code> object to be serialized
* @throws SerialException if an error occurs during serialization
* @throws SQLException if a SQL errors occurs
*/
public SerialBlob(byte[] b)
throws SerialException, SQLException {
len = b.length;
buf = new byte[(int)len];
for(int i = 0; i < len; i++) {
buf[i] = b[i];
}
origLen = len;
}
/**
* Constructs a <code>SerialBlob</code> object that is a serialized
* version of the given <code>Blob</code> object.
* <P>
* The new <code>SerialBlob</code> object is initialized with the
* data from the <code>Blob</code> object; therefore, the
* <code>Blob</code> object should have previously brought the
* SQL <code>BLOB</code> value's data over to the client from
* the database. Otherwise, the new <code>SerialBlob</code> object
* will contain no data.
*
* @param blob the <code>Blob</code> object from which this
* <code>SerialBlob</code> object is to be constructed;
* cannot be null.
* @throws SerialException if an error occurs during serialization
* @throws SQLException if the <code>Blob</code> passed to this
* to this constructor is a <code>null</code>.
* @see java.sql.Blob
*/
public SerialBlob (Blob blob)
throws SerialException, SQLException {
if (blob == null) {
throw new SQLException(
"Cannot instantiate a SerialBlob object with a null Blob object");
}
len = blob.length();
buf = blob.getBytes(1, (int)len );
this.blob = blob;
origLen = len;
}
/**
* Copies the specified number of bytes, starting at the given
* position, from this <code>SerialBlob</code> object to
* another array of bytes.
* <P>
* Note that if the given number of bytes to be copied is larger than
* the length of this <code>SerialBlob</code> object's array of
* bytes, the given number will be shortened to the array's length.
*
* @param pos the ordinal position of the first byte in this
* <code>SerialBlob</code> object to be copied;
* numbering starts at <code>1</code>; must not be less
* than <code>1</code> and must be less than or equal
* to the length of this <code>SerialBlob</code> object
* @param length the number of bytes to be copied
* @return an array of bytes that is a copy of a region of this
* <code>SerialBlob</code> object, starting at the given
* position and containing the given number of consecutive bytes
* @throws SerialException if the given starting position is out of bounds;
* if {@code free} had previously been called on this object
*/
public byte[] getBytes(long pos, int length) throws SerialException {
isValid();
if (length > len) {
length = (int)len;
}
if (pos < 1 || len - pos < 0 ) {
throw new SerialException("Invalid arguments: position cannot be "
+ "less than 1 or greater than the length of the SerialBlob");
}
pos--; // correct pos to array index
byte[] b = new byte[length];
for (int i = 0; i < length; i++) {
b[i] = this.buf[(int)pos];
pos++;
}
return b;
}
/**
* Retrieves the number of bytes in this <code>SerialBlob</code>
* object's array of bytes.
*
* @return a <code>long</code> indicating the length in bytes of this
* <code>SerialBlob</code> object's array of bytes
* @throws SerialException if an error occurs;
* if {@code free} had previously been called on this object
*/
public long length() throws SerialException {
isValid();
return len;
}
/**
* Returns this <code>SerialBlob</code> object as an input stream.
* Unlike the related method, <code>setBinaryStream</code>,
* a stream is produced regardless of whether the <code>SerialBlob</code>
* was created with a <code>Blob</code> object or a <code>byte</code> array.
*
* @return a <code>java.io.InputStream</code> object that contains
* this <code>SerialBlob</code> object's array of bytes
* @throws SerialException if an error occurs;
* if {@code free} had previously been called on this object
* @see #setBinaryStream
*/
public java.io.InputStream getBinaryStream() throws SerialException {
isValid();
InputStream stream = new ByteArrayInputStream(buf);
return stream;
}
/**
* Returns the position in this <code>SerialBlob</code> object where
* the given pattern of bytes begins, starting the search at the
* specified position.
*
* @param pattern the pattern of bytes for which to search
* @param start the position of the byte in this
* <code>SerialBlob</code> object from which to begin
* the search; the first position is <code>1</code>;
* must not be less than <code>1</code> nor greater than
* the length of this <code>SerialBlob</code> object
* @return the position in this <code>SerialBlob</code> object
* where the given pattern begins, starting at the specified
* position; <code>-1</code> if the pattern is not found
* or the given starting position is out of bounds; position
* numbering for the return value starts at <code>1</code>
* @throws SerialException if an error occurs when serializing the blob;
* if {@code free} had previously been called on this object
* @throws SQLException if there is an error accessing the <code>BLOB</code>
* value from the database
*/
public long position(byte[] pattern, long start)
throws SerialException, SQLException {
isValid();
if (start < 1 || start > len) {
return -1;
}
int pos = (int)start-1; // internally Blobs are stored as arrays.
int i = 0;
long patlen = pattern.length;
while (pos < len) {
if (pattern[i] == buf[pos]) {
if (i + 1 == patlen) {
return (pos + 1) - (patlen - 1);
}
i++; pos++; // increment pos, and i
} else if (pattern[i] != buf[pos]) {
pos++; // increment pos only
}
}
return -1; // not found
}
/**
* Returns the position in this <code>SerialBlob</code> object where
* the given <code>Blob</code> object begins, starting the search at the
* specified position.
*
* @param pattern the <code>Blob</code> object for which to search;
* @param start the position of the byte in this
* <code>SerialBlob</code> object from which to begin
* the search; the first position is <code>1</code>;
* must not be less than <code>1</code> nor greater than
* the length of this <code>SerialBlob</code> object
* @return the position in this <code>SerialBlob</code> object
* where the given <code>Blob</code> object begins, starting
* at the specified position; <code>-1</code> if the pattern is
* not found or the given starting position is out of bounds;
* position numbering for the return value starts at <code>1</code>
* @throws SerialException if an error occurs when serializing the blob;
* if {@code free} had previously been called on this object
* @throws SQLException if there is an error accessing the <code>BLOB</code>
* value from the database
*/
public long position(Blob pattern, long start)
throws SerialException, SQLException {
isValid();
return position(pattern.getBytes(1, (int)(pattern.length())), start);
}
/**
* Writes the given array of bytes to the <code>BLOB</code> value that
* this <code>Blob</code> object represents, starting at position
* <code>pos</code>, and returns the number of bytes written.
*
* @param pos the position in the SQL <code>BLOB</code> value at which
* to start writing. The first position is <code>1</code>;
* must not be less than <code>1</code> nor greater than
* the length of this <code>SerialBlob</code> object.
* @param bytes the array of bytes to be written to the <code>BLOB</code>
* value that this <code>Blob</code> object represents
* @return the number of bytes written
* @throws SerialException if there is an error accessing the
* <code>BLOB</code> value; or if an invalid position is set; if an
* invalid offset value is set;
* if {@code free} had previously been called on this object
* @throws SQLException if there is an error accessing the <code>BLOB</code>
* value from the database
* @see #getBytes
*/
public int setBytes(long pos, byte[] bytes)
throws SerialException, SQLException {
return setBytes(pos, bytes, 0, bytes.length);
}
/**
* Writes all or part of the given <code>byte</code> array to the
* <code>BLOB</code> value that this <code>Blob</code> object represents
* and returns the number of bytes written.
* Writing starts at position <code>pos</code> in the <code>BLOB</code>
* value; <i>len</i> bytes from the given byte array are written.
*
* @param pos the position in the <code>BLOB</code> object at which
* to start writing. The first position is <code>1</code>;
* must not be less than <code>1</code> nor greater than
* the length of this <code>SerialBlob</code> object.
* @param bytes the array of bytes to be written to the <code>BLOB</code>
* value
* @param offset the offset in the <code>byte</code> array at which
* to start reading the bytes. The first offset position is
* <code>0</code>; must not be less than <code>0</code> nor greater
* than the length of the <code>byte</code> array
* @param length the number of bytes to be written to the
* <code>BLOB</code> value from the array of bytes <i>bytes</i>.
*
* @return the number of bytes written
* @throws SerialException if there is an error accessing the
* <code>BLOB</code> value; if an invalid position is set; if an
* invalid offset value is set; if number of bytes to be written
* is greater than the <code>SerialBlob</code> length; or the combined
* values of the length and offset is greater than the Blob buffer;
* if {@code free} had previously been called on this object
* @throws SQLException if there is an error accessing the <code>BLOB</code>
* value from the database.
* @see #getBytes
*/
public int setBytes(long pos, byte[] bytes, int offset, int length)
throws SerialException, SQLException {
isValid();
if (offset < 0 || offset > bytes.length) {
throw new SerialException("Invalid offset in byte array set");
}
if (pos < 1 || pos > this.length()) {
throw new SerialException("Invalid position in BLOB object set");
}
if ((long)(length) > origLen) {
throw new SerialException("Buffer is not sufficient to hold the value");
}
if ((length + offset) > bytes.length) {
throw new SerialException("Invalid OffSet. Cannot have combined offset " +
"and length that is greater that the Blob buffer");
}
int i = 0;
pos--; // correct to array indexing
while ( i < length || (offset + i +1) < (bytes.length-offset) ) {
this.buf[(int)pos + i] = bytes[offset + i ];
i++;
}
return i;
}
/**
* Retrieves a stream that can be used to write to the <code>BLOB</code>
* value that this <code>Blob</code> object represents. The stream begins
* at position <code>pos</code>. This method forwards the
* <code>setBinaryStream()</code> call to the underlying <code>Blob</code> in
* the event that this <code>SerialBlob</code> object is instantiated with a
* <code>Blob</code>. If this <code>SerialBlob</code> is instantiated with
* a <code>byte</code> array, a <code>SerialException</code> is thrown.
*
* @param pos the position in the <code>BLOB</code> value at which
* to start writing
* @return a <code>java.io.OutputStream</code> object to which data can
* be written
* @throws SQLException if there is an error accessing the
* <code>BLOB</code> value
* @throws SerialException if the SerialBlob in not instantiated with a
* <code>Blob</code> object that supports <code>setBinaryStream()</code>;
* if {@code free} had previously been called on this object
* @see #getBinaryStream
*/
public java.io.OutputStream setBinaryStream(long pos)
throws SerialException, SQLException {
isValid();
if (this.blob != null) {
return this.blob.setBinaryStream(pos);
} else {
throw new SerialException("Unsupported operation. SerialBlob cannot " +
"return a writable binary stream, unless instantiated with a Blob object " +
"that provides a setBinaryStream() implementation");
}
}
/**
* Truncates the <code>BLOB</code> value that this <code>Blob</code>
* object represents to be <code>len</code> bytes in length.
*
* @param length the length, in bytes, to which the <code>BLOB</code>
* value that this <code>Blob</code> object represents should be
* truncated
* @throws SerialException if there is an error accessing the Blob value;
* or the length to truncate is greater that the SerialBlob length;
* if {@code free} had previously been called on this object
*/
public void truncate(long length) throws SerialException {
isValid();
if (length > len) {
throw new SerialException(
"Length more than what can be truncated");
} else if((int)length == 0) {
buf = new byte[0];
len = length;
} else {
len = length;
buf = this.getBytes(1, (int)len);
}
}
/**
* Returns an
* <code>InputStream</code> object that contains a partial
* {@code Blob} value, starting with the byte specified by pos, which is
* length bytes in length.
*
* @param pos the offset to the first byte of the partial value to be
* retrieved. The first byte in the {@code Blob} is at position 1
* @param length the length in bytes of the partial value to be retrieved
* @return
* <code>InputStream</code> through which the partial {@code Blob} value can
* be read.
* @throws SQLException if pos is less than 1 or if pos is greater than the
* number of bytes in the {@code Blob} or if pos + length is greater than
* the number of bytes in the {@code Blob}
* @throws SerialException if the {@code free} method had been previously
* called on this object
*
* @since 1.6
*/
public InputStream getBinaryStream(long pos, long length) throws SQLException {
isValid();
if (pos < 1 || pos > this.length()) {
throw new SerialException("Invalid position in BLOB object set");
}
if (length < 1 || length > len - pos + 1) {
throw new SerialException(
"length is < 1 or pos + length > total number of bytes");
}
return new ByteArrayInputStream(buf, (int) pos - 1, (int) length);
}
/**
* This method frees the {@code SerialBlob} object and releases the
* resources that it holds. The object is invalid once the {@code free}
* method is called. <p> If {@code free} is called multiple times, the
* subsequent calls to {@code free} are treated as a no-op. </P>
*
* @throws SQLException if an error occurs releasing the Blob's resources
* @since 1.6
*/
public void free() throws SQLException {
if (buf != null) {
buf = null;
if (blob != null) {
blob.free();
}
blob = null;
}
}
/**
* Compares this SerialBlob to the specified object. The result is {@code
* true} if and only if the argument is not {@code null} and is a {@code
* SerialBlob} object that represents the same sequence of bytes as this
* object.
*
* @param obj The object to compare this {@code SerialBlob} against
*
* @return {@code true} if the given object represents a {@code SerialBlob}
* equivalent to this SerialBlob, {@code false} otherwise
*
*/
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SerialBlob) {
SerialBlob sb = (SerialBlob)obj;
if (this.len == sb.len) {
return Arrays.equals(buf, sb.buf);
}
}
return false;
}
/**
* Returns a hash code for this {@code SerialBlob}.
* @return a hash code value for this object.
*/
public int hashCode() {
return ((31 + Arrays.hashCode(buf)) * 31 + (int)len) * 31 + (int)origLen;
}
/**
* Returns a clone of this {@code SerialBlob}. The copy will contain a
* reference to a clone of the internal byte array, not a reference
* to the original internal byte array of this {@code SerialBlob} object.
* The underlying {@code Blob} object will be set to null.
*
* @return a clone of this SerialBlob
*/
public Object clone() {
try {
SerialBlob sb = (SerialBlob) super.clone();
sb.buf = (buf != null) ? Arrays.copyOf(buf, (int)len) : null;
sb.blob = null;
return sb;
} catch (CloneNotSupportedException ex) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
}
/**
* readObject is called to restore the state of the SerialBlob from
* a stream.
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField fields = s.readFields();
byte[] tmp = (byte[])fields.get("buf", null);
if (tmp == null)
throw new InvalidObjectException("buf is null and should not be!");
buf = tmp.clone();
len = fields.get("len", 0L);
if (buf.length != len)
throw new InvalidObjectException("buf is not the expected size");
origLen = fields.get("origLen", 0L);
blob = (Blob) fields.get("blob", null);
}
/**
* writeObject is called to save the state of the SerialBlob
* to a stream.
*/
private void writeObject(ObjectOutputStream s)
throws IOException, ClassNotFoundException {
ObjectOutputStream.PutField fields = s.putFields();
fields.put("buf", buf);
fields.put("len", len);
fields.put("origLen", origLen);
// Note: this check to see if it is an instance of Serializable
// is for backwards compatibility
fields.put("blob", blob instanceof Serializable ? blob : null);
s.writeFields();
}
/**
* Check to see if this object had previously had its {@code free} method
* called
*
* @throws SerialException
*/
private void isValid() throws SerialException {
if (buf == null) {
throw new SerialException("Error: You cannot call a method on a " +
"SerialBlob instance once free() has been called.");
}
}
/**
* The identifier that assists in the serialization of this
* {@code SerialBlob} object.
*/
static final long serialVersionUID = -8144641928112860441L;
}

View file

@ -0,0 +1,696 @@
/*
* Copyright (c) 2003, 2014, 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.serial;
import java.sql.*;
import java.io.*;
import java.util.Arrays;
/**
* A serialized mapping in the Java programming language of an SQL
* <code>CLOB</code> value.
* <P>
* The <code>SerialClob</code> class provides a constructor for creating
* an instance from a <code>Clob</code> object. Note that the <code>Clob</code>
* object should have brought the SQL <code>CLOB</code> value's data over
* to the client before a <code>SerialClob</code> object
* is constructed from it. The data of an SQL <code>CLOB</code> value can
* be materialized on the client as a stream of Unicode characters.
* <P>
* <code>SerialClob</code> methods make it possible to get a substring
* from a <code>SerialClob</code> object or to locate the start of
* a pattern of characters.
*
* <h3> Thread safety </h3>
*
* <p> A SerialClob is not safe for use by multiple concurrent threads. If a
* SerialClob is to be used by more than one thread then access to the SerialClob
* should be controlled by appropriate synchronization.
*
* @author Jonathan Bruce
* @since 1.5
*/
public class SerialClob implements Clob, Serializable, Cloneable {
/**
* A serialized array of characters containing the data of the SQL
* <code>CLOB</code> value that this <code>SerialClob</code> object
* represents.
*
* @serial
*/
private char buf[];
/**
* Internal Clob representation if SerialClob is initialized with a
* Clob. Null if SerialClob is initialized with a char[].
*/
private Clob clob;
/**
* The length in characters of this <code>SerialClob</code> object's
* internal array of characters.
*
* @serial
*/
private long len;
/**
* The original length in characters of this <code>SerialClob</code>
* object's internal array of characters.
*
* @serial
*/
private long origLen;
/**
* Constructs a <code>SerialClob</code> object that is a serialized version of
* the given <code>char</code> array.
* <p>
* The new <code>SerialClob</code> object is initialized with the data from the
* <code>char</code> array, thus allowing disconnected <code>RowSet</code>
* objects to establish a serialized <code>Clob</code> object without touching
* the data source.
*
* @param ch the char array representing the <code>Clob</code> object to be
* serialized
* @throws SerialException if an error occurs during serialization
* @throws SQLException if a SQL error occurs
*/
public SerialClob(char ch[]) throws SerialException, SQLException {
// %%% JMB. Agreed. Add code here to throw a SQLException if no
// support is available for locatorsUpdateCopy=false
// Serializing locators is not supported.
len = ch.length;
buf = new char[(int)len];
for (int i = 0; i < len ; i++){
buf[i] = ch[i];
}
origLen = len;
clob = null;
}
/**
* Constructs a <code>SerialClob</code> object that is a serialized
* version of the given <code>Clob</code> object.
* <P>
* The new <code>SerialClob</code> object is initialized with the
* data from the <code>Clob</code> object; therefore, the
* <code>Clob</code> object should have previously brought the
* SQL <code>CLOB</code> value's data over to the client from
* the database. Otherwise, the new <code>SerialClob</code> object
* object will contain no data.
* <p>
* Note: The <code>Clob</code> object supplied to this constructor must
* return non-null for both the <code>Clob.getCharacterStream()</code>
* and <code>Clob.getAsciiStream</code> methods. This <code>SerialClob</code>
* constructor cannot serialize a <code>Clob</code> object in this instance
* and will throw an <code>SQLException</code> object.
*
* @param clob the <code>Clob</code> object from which this
* <code>SerialClob</code> object is to be constructed; cannot be null
* @throws SerialException if an error occurs during serialization
* @throws SQLException if a SQL error occurs in capturing the CLOB;
* if the <code>Clob</code> object is a null; or if either of the
* <code>Clob.getCharacterStream()</code> and <code>Clob.getAsciiStream()</code>
* methods on the <code>Clob</code> returns a null
* @see java.sql.Clob
*/
public SerialClob(Clob clob) throws SerialException, SQLException {
if (clob == null) {
throw new SQLException("Cannot instantiate a SerialClob " +
"object with a null Clob object");
}
len = clob.length();
this.clob = clob;
buf = new char[(int)len];
int read = 0;
int offset = 0;
try (Reader charStream = clob.getCharacterStream()) {
if (charStream == null) {
throw new SQLException("Invalid Clob object. The call to getCharacterStream " +
"returned null which cannot be serialized.");
}
// Note: get an ASCII stream in order to null-check it,
// even though we don't do anything with it.
try (InputStream asciiStream = clob.getAsciiStream()) {
if (asciiStream == null) {
throw new SQLException("Invalid Clob object. The call to getAsciiStream " +
"returned null which cannot be serialized.");
}
}
try (Reader reader = new BufferedReader(charStream)) {
do {
read = reader.read(buf, offset, (int)(len - offset));
offset += read;
} while (read > 0);
}
} catch (java.io.IOException ex) {
throw new SerialException("SerialClob: " + ex.getMessage());
}
origLen = len;
}
/**
* Retrieves the number of characters in this <code>SerialClob</code>
* object's array of characters.
*
* @return a <code>long</code> indicating the length in characters of this
* <code>SerialClob</code> object's array of character
* @throws SerialException if an error occurs;
* if {@code free} had previously been called on this object
*/
public long length() throws SerialException {
isValid();
return len;
}
/**
* Returns this <code>SerialClob</code> object's data as a stream
* of Unicode characters. Unlike the related method, <code>getAsciiStream</code>,
* a stream is produced regardless of whether the <code>SerialClob</code> object
* was created with a <code>Clob</code> object or a <code>char</code> array.
*
* @return a <code>java.io.Reader</code> object containing this
* <code>SerialClob</code> object's data
* @throws SerialException if an error occurs;
* if {@code free} had previously been called on this object
*/
public java.io.Reader getCharacterStream() throws SerialException {
isValid();
return (java.io.Reader) new CharArrayReader(buf);
}
/**
* Retrieves the <code>CLOB</code> value designated by this <code>SerialClob</code>
* object as an ascii stream. This method forwards the <code>getAsciiStream</code>
* call to the underlying <code>Clob</code> object in the event that this
* <code>SerialClob</code> object is instantiated with a <code>Clob</code>
* object. If this <code>SerialClob</code> object is instantiated with
* a <code>char</code> array, a <code>SerialException</code> object is thrown.
*
* @return a <code>java.io.InputStream</code> object containing
* this <code>SerialClob</code> object's data
* @throws SerialException if this {@code SerialClob} object was not
* instantiated with a <code>Clob</code> object;
* if {@code free} had previously been called on this object
* @throws SQLException if there is an error accessing the
* <code>CLOB</code> value represented by the <code>Clob</code> object
* that was used to create this <code>SerialClob</code> object
*/
public java.io.InputStream getAsciiStream() throws SerialException, SQLException {
isValid();
if (this.clob != null) {
return this.clob.getAsciiStream();
} else {
throw new SerialException("Unsupported operation. SerialClob cannot " +
"return a the CLOB value as an ascii stream, unless instantiated " +
"with a fully implemented Clob object.");
}
}
/**
* Returns a copy of the substring contained in this
* <code>SerialClob</code> object, starting at the given position
* and continuing for the specified number or characters.
*
* @param pos the position of the first character in the substring
* to be copied; the first character of the
* <code>SerialClob</code> object is at position
* <code>1</code>; must not be less than <code>1</code>,
* and the sum of the starting position and the length
* of the substring must be less than the length of this
* <code>SerialClob</code> object
* @param length the number of characters in the substring to be
* returned; must not be greater than the length of
* this <code>SerialClob</code> object, and the
* sum of the starting position and the length
* of the substring must be less than the length of this
* <code>SerialClob</code> object
* @return a <code>String</code> object containing a substring of
* this <code>SerialClob</code> object beginning at the
* given position and containing the specified number of
* consecutive characters
* @throws SerialException if either of the arguments is out of bounds;
* if {@code free} had previously been called on this object
*/
public String getSubString(long pos, int length) throws SerialException {
isValid();
if (pos < 1 || pos > this.length()) {
throw new SerialException("Invalid position in SerialClob object set");
}
if ((pos-1) + length > this.length()) {
throw new SerialException("Invalid position and substring length");
}
try {
return new String(buf, (int)pos - 1, length);
} catch (StringIndexOutOfBoundsException e) {
throw new SerialException("StringIndexOutOfBoundsException: " +
e.getMessage());
}
}
/**
* Returns the position in this <code>SerialClob</code> object
* where the given <code>String</code> object begins, starting
* the search at the specified position. This method returns
* <code>-1</code> if the pattern is not found.
*
* @param searchStr the <code>String</code> object for which to
* search
* @param start the position in this <code>SerialClob</code> object
* at which to start the search; the first position is
* <code>1</code>; must not be less than <code>1</code> nor
* greater than the length of this <code>SerialClob</code> object
* @return the position at which the given <code>String</code> object
* begins, starting the search at the specified position;
* <code>-1</code> if the given <code>String</code> object is
* not found or the starting position is out of bounds; position
* numbering for the return value starts at <code>1</code>
* @throws SerialException if the {@code free} method had been
* previously called on this object
* @throws SQLException if there is an error accessing the Clob value
* from the database.
*/
public long position(String searchStr, long start)
throws SerialException, SQLException {
isValid();
if (start < 1 || start > len) {
return -1;
}
char pattern[] = searchStr.toCharArray();
int pos = (int)start-1;
int i = 0;
long patlen = pattern.length;
while (pos < len) {
if (pattern[i] == buf[pos]) {
if (i + 1 == patlen) {
return (pos + 1) - (patlen - 1);
}
i++; pos++; // increment pos, and i
} else if (pattern[i] != buf[pos]) {
pos++; // increment pos only
}
}
return -1; // not found
}
/**
* Returns the position in this <code>SerialClob</code> object
* where the given <code>Clob</code> signature begins, starting
* the search at the specified position. This method returns
* <code>-1</code> if the pattern is not found.
*
* @param searchStr the <code>Clob</code> object for which to search
* @param start the position in this <code>SerialClob</code> object
* at which to begin the search; the first position is
* <code>1</code>; must not be less than <code>1</code> nor
* greater than the length of this <code>SerialClob</code> object
* @return the position at which the given <code>Clob</code>
* object begins in this <code>SerialClob</code> object,
* at or after the specified starting position
* @throws SerialException if an error occurs locating the Clob signature;
* if the {@code free} method had been previously called on this object
* @throws SQLException if there is an error accessing the Clob value
* from the database
*/
public long position(Clob searchStr, long start)
throws SerialException, SQLException {
isValid();
return position(searchStr.getSubString(1,(int)searchStr.length()), start);
}
/**
* Writes the given Java <code>String</code> to the <code>CLOB</code>
* value that this <code>SerialClob</code> object represents, at the position
* <code>pos</code>.
*
* @param pos the position at which to start writing to the <code>CLOB</code>
* value that this <code>SerialClob</code> object represents; the first
* position is <code>1</code>; must not be less than <code>1</code> nor
* greater than the length of this <code>SerialClob</code> object
* @param str the string to be written to the <code>CLOB</code>
* value that this <code>SerialClob</code> object represents
* @return the number of characters written
* @throws SerialException if there is an error accessing the
* <code>CLOB</code> value; if an invalid position is set; if an
* invalid offset value is set; if number of bytes to be written
* is greater than the <code>SerialClob</code> length; or the combined
* values of the length and offset is greater than the Clob buffer;
* if the {@code free} method had been previously called on this object
*/
public int setString(long pos, String str) throws SerialException {
return (setString(pos, str, 0, str.length()));
}
/**
* Writes <code>len</code> characters of <code>str</code>, starting
* at character <code>offset</code>, to the <code>CLOB</code> value
* that this <code>Clob</code> represents.
*
* @param pos the position at which to start writing to the <code>CLOB</code>
* value that this <code>SerialClob</code> object represents; the first
* position is <code>1</code>; must not be less than <code>1</code> nor
* greater than the length of this <code>SerialClob</code> object
* @param str the string to be written to the <code>CLOB</code>
* value that this <code>Clob</code> object represents
* @param offset the offset into <code>str</code> to start reading
* the characters to be written
* @param length the number of characters to be written
* @return the number of characters written
* @throws SerialException if there is an error accessing the
* <code>CLOB</code> value; if an invalid position is set; if an
* invalid offset value is set; if number of bytes to be written
* is greater than the <code>SerialClob</code> length; or the combined
* values of the length and offset is greater than the Clob buffer;
* if the {@code free} method had been previously called on this object
*/
public int setString(long pos, String str, int offset, int length)
throws SerialException {
isValid();
String temp = str.substring(offset);
char cPattern[] = temp.toCharArray();
if (offset < 0 || offset > str.length()) {
throw new SerialException("Invalid offset in byte array set");
}
if (pos < 1 || pos > this.length()) {
throw new SerialException("Invalid position in Clob object set");
}
if ((long)(length) > origLen) {
throw new SerialException("Buffer is not sufficient to hold the value");
}
if ((length + offset) > str.length()) {
// need check to ensure length + offset !> bytes.length
throw new SerialException("Invalid OffSet. Cannot have combined offset " +
" and length that is greater that the Blob buffer");
}
int i = 0;
pos--; //values in the array are at position one less
while ( i < length || (offset + i +1) < (str.length() - offset ) ) {
this.buf[(int)pos + i ] = cPattern[offset + i ];
i++;
}
return i;
}
/**
* Retrieves a stream to be used to write Ascii characters to the
* <code>CLOB</code> value that this <code>SerialClob</code> object represents,
* starting at position <code>pos</code>. This method forwards the
* <code>setAsciiStream()</code> call to the underlying <code>Clob</code> object in
* the event that this <code>SerialClob</code> object is instantiated with a
* <code>Clob</code> object. If this <code>SerialClob</code> object is instantiated
* with a <code>char</code> array, a <code>SerialException</code> object is thrown.
*
* @param pos the position at which to start writing to the
* <code>CLOB</code> object
* @return the stream to which ASCII encoded characters can be written
* @throws SerialException if SerialClob is not instantiated with a
* Clob object;
* if the {@code free} method had been previously called on this object
* @throws SQLException if there is an error accessing the
* <code>CLOB</code> value
* @see #getAsciiStream
*/
public java.io.OutputStream setAsciiStream(long pos)
throws SerialException, SQLException {
isValid();
if (this.clob != null) {
return this.clob.setAsciiStream(pos);
} else {
throw new SerialException("Unsupported operation. SerialClob cannot " +
"return a writable ascii stream\n unless instantiated with a Clob object " +
"that has a setAsciiStream() implementation");
}
}
/**
* Retrieves a stream to be used to write a stream of Unicode characters
* to the <code>CLOB</code> value that this <code>SerialClob</code> object
* represents, at position <code>pos</code>. This method forwards the
* <code>setCharacterStream()</code> call to the underlying <code>Clob</code>
* object in the event that this <code>SerialClob</code> object is instantiated with a
* <code>Clob</code> object. If this <code>SerialClob</code> object is instantiated with
* a <code>char</code> array, a <code>SerialException</code> is thrown.
*
* @param pos the position at which to start writing to the
* <code>CLOB</code> value
*
* @return a stream to which Unicode encoded characters can be written
* @throws SerialException if the SerialClob is not instantiated with
* a Clob object;
* if the {@code free} method had been previously called on this object
* @throws SQLException if there is an error accessing the
* <code>CLOB</code> value
* @see #getCharacterStream
*/
public java.io.Writer setCharacterStream(long pos)
throws SerialException, SQLException {
isValid();
if (this.clob != null) {
return this.clob.setCharacterStream(pos);
} else {
throw new SerialException("Unsupported operation. SerialClob cannot " +
"return a writable character stream\n unless instantiated with a Clob object " +
"that has a setCharacterStream implementation");
}
}
/**
* Truncates the <code>CLOB</code> value that this <code>SerialClob</code>
* object represents so that it has a length of <code>len</code>
* characters.
* <p>
* Truncating a <code>SerialClob</code> object to length 0 has the effect of
* clearing its contents.
*
* @param length the length, in bytes, to which the <code>CLOB</code>
* value should be truncated
* @throws SerialException if there is an error accessing the
* <code>CLOB</code> value;
* if the {@code free} method had been previously called on this object
*/
public void truncate(long length) throws SerialException {
isValid();
if (length > len) {
throw new SerialException
("Length more than what can be truncated");
} else {
len = length;
// re-size the buffer
if (len == 0) {
buf = new char[] {};
} else {
buf = (this.getSubString(1, (int)len)).toCharArray();
}
}
}
/**
* Returns a {@code Reader} object that contains a partial
* {@code SerialClob} value, starting
* with the character specified by pos, which is length characters in length.
*
* @param pos the offset to the first character of the partial value to
* be retrieved. The first character in the {@code SerialClob} is at position 1.
* @param length the length in characters of the partial value to be retrieved.
* @return {@code Reader} through which the partial {@code SerialClob}
* value can be read.
* @throws SQLException if pos is less than 1 or if pos is greater than the
* number of characters in the {@code SerialClob} or if pos + length
* is greater than the number of characters in the {@code SerialClob};
* @throws SerialException if the {@code free} method had been previously
* called on this object
* @since 1.6
*/
public Reader getCharacterStream(long pos, long length) throws SQLException {
isValid();
if (pos < 1 || pos > len) {
throw new SerialException("Invalid position in Clob object set");
}
if ((pos-1) + length > len) {
throw new SerialException("Invalid position and substring length");
}
if (length <= 0) {
throw new SerialException("Invalid length specified");
}
return new CharArrayReader(buf, (int)pos, (int)length);
}
/**
* This method frees the {@code SerialClob} object and releases the
* resources that it holds.
* The object is invalid once the {@code free} method is called.
* <p>
* If {@code free} is called multiple times, the subsequent
* calls to {@code free} are treated as a no-op.
* </P>
* @throws SQLException if an error occurs releasing
* the Clob's resources
* @since 1.6
*/
public void free() throws SQLException {
if (buf != null) {
buf = null;
if (clob != null) {
clob.free();
}
clob = null;
}
}
/**
* Compares this SerialClob to the specified object. The result is {@code
* true} if and only if the argument is not {@code null} and is a {@code
* SerialClob} object that represents the same sequence of characters as this
* object.
*
* @param obj The object to compare this {@code SerialClob} against
*
* @return {@code true} if the given object represents a {@code SerialClob}
* equivalent to this SerialClob, {@code false} otherwise
*
*/
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SerialClob) {
SerialClob sc = (SerialClob)obj;
if (this.len == sc.len) {
return Arrays.equals(buf, sc.buf);
}
}
return false;
}
/**
* Returns a hash code for this {@code SerialClob}.
* @return a hash code value for this object.
*/
public int hashCode() {
return ((31 + Arrays.hashCode(buf)) * 31 + (int)len) * 31 + (int)origLen;
}
/**
* Returns a clone of this {@code SerialClob}. The copy will contain a
* reference to a clone of the internal character array, not a reference
* to the original internal character array of this {@code SerialClob} object.
* The underlying {@code Clob} object will be set to null.
*
* @return a clone of this SerialClob
*/
public Object clone() {
try {
SerialClob sc = (SerialClob) super.clone();
sc.buf = (buf != null) ? Arrays.copyOf(buf, (int)len) : null;
sc.clob = null;
return sc;
} catch (CloneNotSupportedException ex) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
}
/**
* readObject is called to restore the state of the SerialClob from
* a stream.
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField fields = s.readFields();
char[] tmp = (char[])fields.get("buf", null);
if (tmp == null)
throw new InvalidObjectException("buf is null and should not be!");
buf = tmp.clone();
len = fields.get("len", 0L);
if (buf.length != len)
throw new InvalidObjectException("buf is not the expected size");
origLen = fields.get("origLen", 0L);
clob = (Clob) fields.get("clob", null);
}
/**
* writeObject is called to save the state of the SerialClob
* to a stream.
*/
private void writeObject(ObjectOutputStream s)
throws IOException, ClassNotFoundException {
ObjectOutputStream.PutField fields = s.putFields();
fields.put("buf", buf);
fields.put("len", len);
fields.put("origLen", origLen);
// Note: this check to see if it is an instance of Serializable
// is for backwards compatibility
fields.put("clob", clob instanceof Serializable ? clob : null);
s.writeFields();
}
/**
* Check to see if this object had previously had its {@code free} method
* called
*
* @throws SerialException
*/
private void isValid() throws SerialException {
if (buf == null) {
throw new SerialException("Error: You cannot call a method on a "
+ "SerialClob instance once free() has been called.");
}
}
/**
* The identifier that assists in the serialization of this {@code SerialClob}
* object.
*/
static final long serialVersionUID = -1662519690087375313L;
}

View file

@ -0,0 +1,172 @@
/*
* Copyright (c) 2003, 2014, 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.serial;
import java.sql.*;
import java.io.*;
import java.net.URL;
/**
* A serialized mapping in the Java programming language of an SQL
* <code>DATALINK</code> value. A <code>DATALINK</code> value
* references a file outside of the underlying data source that the
* data source manages.
* <P>
* <code>RowSet</code> implementations can use the method <code>RowSet.getURL</code>
* to retrieve a <code>java.net.URL</code> object, which can be used
* to manipulate the external data.
* <pre>
* java.net.URL url = rowset.getURL(1);
* </pre>
*
* <h3> Thread safety </h3>
*
* A SerialDatalink is not safe for use by multiple concurrent threads. If a
* SerialDatalink is to be used by more than one thread then access to the
* SerialDatalink should be controlled by appropriate synchronization.
*
* @since 1.5
*/
public class SerialDatalink implements Serializable, Cloneable {
/**
* The extracted URL field retrieved from the DATALINK field.
* @serial
*/
private URL url;
/**
* The SQL type of the elements in this <code>SerialDatalink</code>
* object. The type is expressed as one of the constants from the
* class <code>java.sql.Types</code>.
* @serial
*/
private int baseType;
/**
* The type name used by the DBMS for the elements in the SQL
* <code>DATALINK</code> value that this SerialDatalink object
* represents.
* @serial
*/
private String baseTypeName;
/**
* Constructs a new <code>SerialDatalink</code> object from the given
* <code>java.net.URL</code> object.
*
* @param url the {@code URL} to create the {@code SerialDataLink} from
* @throws SerialException if url parameter is a null
*/
public SerialDatalink(URL url) throws SerialException {
if (url == null) {
throw new SerialException("Cannot serialize empty URL instance");
}
this.url = url;
}
/**
* Returns a new URL that is a copy of this <code>SerialDatalink</code>
* object.
*
* @return a copy of this <code>SerialDatalink</code> object as a
* <code>URL</code> object in the Java programming language.
* @throws SerialException if the <code>URL</code> object cannot be de-serialized
*/
public URL getDatalink() throws SerialException {
URL aURL = null;
try {
aURL = new URL((this.url).toString());
} catch (java.net.MalformedURLException e) {
throw new SerialException("MalformedURLException: " + e.getMessage());
}
return aURL;
}
/**
* Compares this {@code SerialDatalink} to the specified object.
* The result is {@code true} if and only if the argument is not
* {@code null} and is a {@code SerialDatalink} object whose URL is
* identical to this object's URL
*
* @param obj The object to compare this {@code SerialDatalink} against
*
* @return {@code true} if the given object represents a {@code SerialDatalink}
* equivalent to this SerialDatalink, {@code false} otherwise
*
*/
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SerialDatalink) {
SerialDatalink sdl = (SerialDatalink) obj;
return url.equals(sdl.url);
}
return false;
}
/**
* Returns a hash code for this {@code SerialDatalink}. The hash code for a
* {@code SerialDatalink} object is taken as the hash code of
* the {@code URL} it stores
*
* @return a hash code value for this object.
*/
public int hashCode() {
return 31 + url.hashCode();
}
/**
* Returns a clone of this {@code SerialDatalink}.
*
* @return a clone of this SerialDatalink
*/
public Object clone() {
try {
SerialDatalink sdl = (SerialDatalink) super.clone();
return sdl;
} catch (CloneNotSupportedException ex) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
}
/**
* readObject and writeObject are called to restore the state
* of the {@code SerialDatalink}
* from a stream. Note: we leverage the default Serialized form
*/
/**
* The identifier that assists in the serialization of this
* {@code SerialDatalink} object.
*/
static final long serialVersionUID = 2826907821828733626L;
}

View file

@ -0,0 +1,57 @@
/*
* Copyright (c) 2003, 2004, 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.serial;
import java.sql.SQLException;
/**
* Indicates and an error with the serialization or de-serialization of
* SQL types such as <code>BLOB, CLOB, STRUCT or ARRAY</code> in
* addition to SQL types such as <code>DATALINK and JAVAOBJECT</code>
*
* @since 1.5
*/
public class SerialException extends java.sql.SQLException {
/**
* Creates a new <code>SerialException</code> without a
* message.
*/
public SerialException() {
}
/**
* Creates a new <code>SerialException</code> with the
* specified message.
*
* @param msg the detail message
*/
public SerialException(String msg) {
super(msg);
}
static final long serialVersionUID = -489794565168592690L;
}

View file

@ -0,0 +1,281 @@
/*
* Copyright (c) 2003, 2014, 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.serial;
import java.io.*;
import java.lang.reflect.*;
import java.util.Arrays;
import java.util.Vector;
import javax.sql.rowset.RowSetWarning;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
import sun.reflect.misc.ReflectUtil;
/**
* A serializable mapping in the Java programming language of an SQL
* <code>JAVA_OBJECT</code> value. Assuming the Java object
* implements the <code>Serializable</code> interface, this class simply wraps the
* serialization process.
* <P>
* If however, the serialization is not possible because
* the Java object is not immediately serializable, this class will
* attempt to serialize all non-static members to permit the object
* state to be serialized.
* Static or transient fields cannot be serialized; an attempt to serialize
* them will result in a <code>SerialException</code> object being thrown.
*
* <h3> Thread safety </h3>
*
* A SerialJavaObject is not safe for use by multiple concurrent threads. If a
* SerialJavaObject is to be used by more than one thread then access to the
* SerialJavaObject should be controlled by appropriate synchronization.
*
* @author Jonathan Bruce
* @since 1.5
*/
public class SerialJavaObject implements Serializable, Cloneable {
/**
* Placeholder for object to be serialized.
*/
private Object obj;
/**
* Placeholder for all fields in the <code>JavaObject</code> being serialized.
*/
private transient Field[] fields;
/**
* Constructor for <code>SerialJavaObject</code> helper class.
*
* @param obj the Java <code>Object</code> to be serialized
* @throws SerialException if the object is found not to be serializable
*/
public SerialJavaObject(Object obj) throws SerialException {
// if any static fields are found, an exception
// should be thrown
// get Class. Object instance should always be available
Class<?> c = obj.getClass();
// determine if object implements Serializable i/f
if (!(obj instanceof java.io.Serializable)) {
setWarning(new RowSetWarning("Warning, the object passed to the constructor does not implement Serializable"));
}
// can only determine public fields (obviously). If
// any of these are static, this should invalidate
// the action of attempting to persist these fields
// in a serialized form
fields = c.getFields();
if (hasStaticFields(fields)) {
throw new SerialException("Located static fields in " +
"object instance. Cannot serialize");
}
this.obj = obj;
}
/**
* Returns an <code>Object</code> that is a copy of this <code>SerialJavaObject</code>
* object.
*
* @return a copy of this <code>SerialJavaObject</code> object as an
* <code>Object</code> in the Java programming language
* @throws SerialException if the instance is corrupt
*/
public Object getObject() throws SerialException {
return this.obj;
}
/**
* Returns an array of <code>Field</code> objects that contains each
* field of the object that this helper class is serializing.
*
* @return an array of <code>Field</code> objects
* @throws SerialException if an error is encountered accessing
* the serialized object
* @throws SecurityException If a security manager, <i>s</i>, is present
* and the caller's class loader is not the same as or an
* ancestor of the class loader for the class of the
* {@linkplain #getObject object} being serialized
* and invocation of {@link SecurityManager#checkPackageAccess
* s.checkPackageAccess()} denies access to the package
* of that class.
* @see Class#getFields
*/
@CallerSensitive
public Field[] getFields() throws SerialException {
if (fields != null) {
Class<?> c = this.obj.getClass();
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
/*
* Check if the caller is allowed to access the specified class's package.
* If access is denied, throw a SecurityException.
*/
Class<?> caller = Reflection.getCallerClass();
if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(),
c.getClassLoader())) {
ReflectUtil.checkPackageAccess(c);
}
}
return c.getFields();
} else {
throw new SerialException("SerialJavaObject does not contain" +
" a serialized object instance");
}
}
/**
* The identifier that assists in the serialization of this
* <code>SerialJavaObject</code> object.
*/
static final long serialVersionUID = -1465795139032831023L;
/**
* A container for the warnings issued on this <code>SerialJavaObject</code>
* object. When there are multiple warnings, each warning is chained to the
* previous warning.
*/
Vector<RowSetWarning> chain;
/**
* Compares this SerialJavaObject to the specified object.
* The result is {@code true} if and only if the argument
* is not {@code null} and is a {@code SerialJavaObject}
* object that is identical to this object
*
* @param o The object to compare this {@code SerialJavaObject} against
*
* @return {@code true} if the given object represents a {@code SerialJavaObject}
* equivalent to this SerialJavaObject, {@code false} otherwise
*
*/
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o instanceof SerialJavaObject) {
SerialJavaObject sjo = (SerialJavaObject) o;
return obj.equals(sjo.obj);
}
return false;
}
/**
* Returns a hash code for this SerialJavaObject. The hash code for a
* {@code SerialJavaObject} object is taken as the hash code of
* the {@code Object} it stores
*
* @return a hash code value for this object.
*/
public int hashCode() {
return 31 + obj.hashCode();
}
/**
* Returns a clone of this {@code SerialJavaObject}.
*
* @return a clone of this SerialJavaObject
*/
public Object clone() {
try {
SerialJavaObject sjo = (SerialJavaObject) super.clone();
sjo.fields = Arrays.copyOf(fields, fields.length);
if (chain != null)
sjo.chain = new Vector<>(chain);
return sjo;
} catch (CloneNotSupportedException ex) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
}
/**
* Registers the given warning.
*/
private void setWarning(RowSetWarning e) {
if (chain == null) {
chain = new Vector<>();
}
chain.add(e);
}
/**
* readObject is called to restore the state of the {@code SerialJavaObject}
* from a stream.
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField fields1 = s.readFields();
@SuppressWarnings("unchecked")
Vector<RowSetWarning> tmp = (Vector<RowSetWarning>)fields1.get("chain", null);
if (tmp != null)
chain = new Vector<>(tmp);
obj = fields1.get("obj", null);
if (obj != null) {
fields = obj.getClass().getFields();
if(hasStaticFields(fields))
throw new IOException("Located static fields in " +
"object instance. Cannot serialize");
} else {
throw new IOException("Object cannot be null!");
}
}
/**
* writeObject is called to save the state of the {@code SerialJavaObject}
* to a stream.
*/
private void writeObject(ObjectOutputStream s)
throws IOException {
ObjectOutputStream.PutField fields = s.putFields();
fields.put("obj", obj);
fields.put("chain", chain);
s.writeFields();
}
/*
* Check to see if there are any Static Fields in this object
*/
private static boolean hasStaticFields(Field[] fields) {
for (Field field : fields) {
if ( field.getModifiers() == Modifier.STATIC) {
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,258 @@
/*
* Copyright (c) 2003, 2014, 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.serial;
import java.sql.*;
import java.io.*;
import java.util.*;
/**
* A serialized mapping of a <code>Ref</code> object, which is the mapping in the
* Java programming language of an SQL <code>REF</code> value.
* <p>
* The <code>SerialRef</code> class provides a constructor for
* creating a <code>SerialRef</code> instance from a <code>Ref</code>
* object and provides methods for getting and setting the <code>Ref</code> object.
*
* <h3> Thread safety </h3>
*
* A SerialRef is not safe for use by multiple concurrent threads. If a
* SerialRef is to be used by more than one thread then access to the SerialRef
* should be controlled by appropriate synchronization.
*
* @since 1.5
*/
public class SerialRef implements Ref, Serializable, Cloneable {
/**
* String containing the base type name.
* @serial
*/
private String baseTypeName;
/**
* This will store the type <code>Ref</code> as an <code>Object</code>.
*/
private Object object;
/**
* Private copy of the Ref reference.
*/
private Ref reference;
/**
* Constructs a <code>SerialRef</code> object from the given <code>Ref</code>
* object.
*
* @param ref a Ref object; cannot be <code>null</code>
* @throws SQLException if a database access occurs; if <code>ref</code>
* is <code>null</code>; or if the <code>Ref</code> object returns a
* <code>null</code> value base type name.
* @throws SerialException if an error occurs serializing the <code>Ref</code>
* object
*/
public SerialRef(Ref ref) throws SerialException, SQLException {
if (ref == null) {
throw new SQLException("Cannot instantiate a SerialRef object " +
"with a null Ref object");
}
reference = ref;
object = ref;
if (ref.getBaseTypeName() == null) {
throw new SQLException("Cannot instantiate a SerialRef object " +
"that returns a null base type name");
} else {
baseTypeName = ref.getBaseTypeName();
}
}
/**
* Returns a string describing the base type name of the <code>Ref</code>.
*
* @return a string of the base type name of the Ref
* @throws SerialException in no Ref object has been set
*/
public String getBaseTypeName() throws SerialException {
return baseTypeName;
}
/**
* Returns an <code>Object</code> representing the SQL structured type
* to which this <code>SerialRef</code> object refers. The attributes
* of the structured type are mapped according to the given type map.
*
* @param map a <code>java.util.Map</code> object containing zero or
* more entries, with each entry consisting of 1) a <code>String</code>
* giving the fully qualified name of a UDT and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped
* @return an object instance resolved from the Ref reference and mapped
* according to the supplied type map
* @throws SerialException if an error is encountered in the reference
* resolution
*/
public Object getObject(java.util.Map<String,Class<?>> map)
throws SerialException
{
map = new Hashtable<String, Class<?>>(map);
if (object != null) {
return map.get(object);
} else {
throw new SerialException("The object is not set");
}
}
/**
* Returns an <code>Object</code> representing the SQL structured type
* to which this <code>SerialRef</code> object refers.
*
* @return an object instance resolved from the Ref reference
* @throws SerialException if an error is encountered in the reference
* resolution
*/
public Object getObject() throws SerialException {
if (reference != null) {
try {
return reference.getObject();
} catch (SQLException e) {
throw new SerialException("SQLException: " + e.getMessage());
}
}
if (object != null) {
return object;
}
throw new SerialException("The object is not set");
}
/**
* Sets the SQL structured type that this <code>SerialRef</code> object
* references to the given <code>Object</code> object.
*
* @param obj an <code>Object</code> representing the SQL structured type
* to be referenced
* @throws SerialException if an error is encountered generating the
* the structured type referenced by this <code>SerialRef</code> object
*/
public void setObject(Object obj) throws SerialException {
try {
reference.setObject(obj);
} catch (SQLException e) {
throw new SerialException("SQLException: " + e.getMessage());
}
object = obj;
}
/**
* Compares this SerialRef to the specified object. The result is {@code
* true} if and only if the argument is not {@code null} and is a {@code
* SerialRef} object that represents the same object as this
* object.
*
* @param obj The object to compare this {@code SerialRef} against
*
* @return {@code true} if the given object represents a {@code SerialRef}
* equivalent to this SerialRef, {@code false} otherwise
*
*/
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if(obj instanceof SerialRef) {
SerialRef ref = (SerialRef)obj;
return baseTypeName.equals(ref.baseTypeName) &&
object.equals(ref.object);
}
return false;
}
/**
* Returns a hash code for this {@code SerialRef}.
* @return a hash code value for this object.
*/
public int hashCode() {
return (31 + object.hashCode()) * 31 + baseTypeName.hashCode();
}
/**
* Returns a clone of this {@code SerialRef}.
* The underlying {@code Ref} object will be set to null.
*
* @return a clone of this SerialRef
*/
public Object clone() {
try {
SerialRef ref = (SerialRef) super.clone();
ref.reference = null;
return ref;
} catch (CloneNotSupportedException ex) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
}
/**
* readObject is called to restore the state of the SerialRef from
* a stream.
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField fields = s.readFields();
object = fields.get("object", null);
baseTypeName = (String) fields.get("baseTypeName", null);
reference = (Ref) fields.get("reference", null);
}
/**
* writeObject is called to save the state of the SerialRef
* to a stream.
*/
private void writeObject(ObjectOutputStream s)
throws IOException, ClassNotFoundException {
ObjectOutputStream.PutField fields = s.putFields();
fields.put("baseTypeName", baseTypeName);
fields.put("object", object);
// Note: this check to see if it is an instance of Serializable
// is for backwards compatibility
fields.put("reference", reference instanceof Serializable ? reference : null);
s.writeFields();
}
/**
* The identifier that assists in the serialization of this <code>SerialRef</code>
* object.
*/
static final long serialVersionUID = -4727123500609662274L;
}

View file

@ -0,0 +1,348 @@
/*
* Copyright (c) 2003, 2013, 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.serial;
import java.sql.*;
import javax.sql.*;
import java.io.*;
import java.math.*;
import java.util.Arrays;
import java.util.Map;
import java.util.Vector;
import javax.sql.rowset.*;
/**
* A serialized mapping in the Java programming language of an SQL
* structured type. Each attribute that is not already serialized
* is mapped to a serialized form, and if an attribute is itself
* a structured type, each of its attributes that is not already
* serialized is mapped to a serialized form.
* <P>
* In addition, the structured type is custom mapped to a class in the
* Java programming language if there is such a mapping, as are
* its attributes, if appropriate.
* <P>
* The <code>SerialStruct</code> class provides a constructor for creating
* an instance from a <code>Struct</code> object, a method for retrieving
* the SQL type name of the SQL structured type in the database, and methods
* for retrieving its attribute values.
*
* <h3> Thread safety </h3>
*
* A SerialStruct is not safe for use by multiple concurrent threads. If a
* SerialStruct is to be used by more than one thread then access to the
* SerialStruct should be controlled by appropriate synchronization.
*
* @since 1.5
*/
public class SerialStruct implements Struct, Serializable, Cloneable {
/**
* The SQL type name for the structured type that this
* <code>SerialStruct</code> object represents. This is the name
* used in the SQL definition of the SQL structured type.
*
* @serial
*/
private String SQLTypeName;
/**
* An array of <code>Object</code> instances in which each
* element is an attribute of the SQL structured type that this
* <code>SerialStruct</code> object represents. The attributes are
* ordered according to their order in the definition of the
* SQL structured type.
*
* @serial
*/
private Object attribs[];
/**
* Constructs a <code>SerialStruct</code> object from the given
* <code>Struct</code> object, using the given <code>java.util.Map</code>
* object for custom mapping the SQL structured type or any of its
* attributes that are SQL structured types.
*
* @param in an instance of {@code Struct}
* @param map a <code>java.util.Map</code> object in which
* each entry consists of 1) a <code>String</code> object
* giving the fully qualified name of a UDT and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped
* @throws SerialException if an error occurs
* @see java.sql.Struct
*/
public SerialStruct(Struct in, Map<String,Class<?>> map)
throws SerialException
{
try {
// get the type name
SQLTypeName = in.getSQLTypeName();
System.out.println("SQLTypeName: " + SQLTypeName);
// get the attributes of the struct
attribs = in.getAttributes(map);
/*
* the array may contain further Structs
* and/or classes that have been mapped,
* other types that we have to serialize
*/
mapToSerial(map);
} catch (SQLException e) {
throw new SerialException(e.getMessage());
}
}
/**
* Constructs a <code>SerialStruct</code> object from the
* given <code>SQLData</code> object, using the given type
* map to custom map it to a class in the Java programming
* language. The type map gives the SQL type and the class
* to which it is mapped. The <code>SQLData</code> object
* defines the class to which the SQL type will be mapped.
*
* @param in an instance of the <code>SQLData</code> class
* that defines the mapping of the SQL structured
* type to one or more objects in the Java programming language
* @param map a <code>java.util.Map</code> object in which
* each entry consists of 1) a <code>String</code> object
* giving the fully qualified name of a UDT and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped
* @throws SerialException if an error occurs
*/
public SerialStruct(SQLData in, Map<String,Class<?>> map)
throws SerialException
{
try {
//set the type name
SQLTypeName = in.getSQLTypeName();
Vector<Object> tmp = new Vector<>();
in.writeSQL(new SQLOutputImpl(tmp, map));
attribs = tmp.toArray();
} catch (SQLException e) {
throw new SerialException(e.getMessage());
}
}
/**
* Retrieves the SQL type name for this <code>SerialStruct</code>
* object. This is the name used in the SQL definition of the
* structured type
*
* @return a <code>String</code> object representing the SQL
* type name for the SQL structured type that this
* <code>SerialStruct</code> object represents
* @throws SerialException if an error occurs
*/
public String getSQLTypeName() throws SerialException {
return SQLTypeName;
}
/**
* Retrieves an array of <code>Object</code> values containing the
* attributes of the SQL structured type that this
* <code>SerialStruct</code> object represents.
*
* @return an array of <code>Object</code> values, with each
* element being an attribute of the SQL structured type
* that this <code>SerialStruct</code> object represents
* @throws SerialException if an error occurs
*/
public Object[] getAttributes() throws SerialException {
Object[] val = this.attribs;
return (val == null) ? null : Arrays.copyOf(val, val.length);
}
/**
* Retrieves the attributes for the SQL structured type that
* this <code>SerialStruct</code> represents as an array of
* <code>Object</code> values, using the given type map for
* custom mapping if appropriate.
*
* @param map a <code>java.util.Map</code> object in which
* each entry consists of 1) a <code>String</code> object
* giving the fully qualified name of a UDT and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped
* @return an array of <code>Object</code> values, with each
* element being an attribute of the SQL structured
* type that this <code>SerialStruct</code> object
* represents
* @throws SerialException if an error occurs
*/
public Object[] getAttributes(Map<String,Class<?>> map)
throws SerialException
{
Object[] val = this.attribs;
return (val == null) ? null : Arrays.copyOf(val, val.length);
}
/**
* Maps attributes of an SQL structured type that are not
* serialized to a serialized form, using the given type map
* for custom mapping when appropriate. The following types
* in the Java programming language are mapped to their
* serialized forms: <code>Struct</code>, <code>SQLData</code>,
* <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, and
* <code>Array</code>.
* <P>
* This method is called internally and is not used by an
* application programmer.
*
* @param map a <code>java.util.Map</code> object in which
* each entry consists of 1) a <code>String</code> object
* giving the fully qualified name of a UDT and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped
* @throws SerialException if an error occurs
*/
private void mapToSerial(Map<String,Class<?>> map) throws SerialException {
try {
for (int i = 0; i < attribs.length; i++) {
if (attribs[i] instanceof Struct) {
attribs[i] = new SerialStruct((Struct)attribs[i], map);
} else if (attribs[i] instanceof SQLData) {
attribs[i] = new SerialStruct((SQLData)attribs[i], map);
} else if (attribs[i] instanceof Blob) {
attribs[i] = new SerialBlob((Blob)attribs[i]);
} else if (attribs[i] instanceof Clob) {
attribs[i] = new SerialClob((Clob)attribs[i]);
} else if (attribs[i] instanceof Ref) {
attribs[i] = new SerialRef((Ref)attribs[i]);
} else if (attribs[i] instanceof java.sql.Array) {
attribs[i] = new SerialArray((java.sql.Array)attribs[i], map);
}
}
} catch (SQLException e) {
throw new SerialException(e.getMessage());
}
return;
}
/**
* Compares this SerialStruct to the specified object. The result is
* {@code true} if and only if the argument is not {@code null} and is a
* {@code SerialStruct} object whose attributes are identical to this
* object's attributes
*
* @param obj The object to compare this {@code SerialStruct} against
*
* @return {@code true} if the given object represents a {@code SerialStruct}
* equivalent to this SerialStruct, {@code false} otherwise
*
*/
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SerialStruct) {
SerialStruct ss = (SerialStruct)obj;
return SQLTypeName.equals(ss.SQLTypeName) &&
Arrays.equals(attribs, ss.attribs);
}
return false;
}
/**
* Returns a hash code for this {@code SerialStruct}. The hash code for a
* {@code SerialStruct} object is computed using the hash codes
* of the attributes of the {@code SerialStruct} object and its
* {@code SQLTypeName}
*
* @return a hash code value for this object.
*/
public int hashCode() {
return ((31 + Arrays.hashCode(attribs)) * 31) * 31
+ SQLTypeName.hashCode();
}
/**
* Returns a clone of this {@code SerialStruct}. The copy will contain a
* reference to a clone of the underlying attribs array, not a reference
* to the original underlying attribs array of this {@code SerialStruct} object.
*
* @return a clone of this SerialStruct
*/
public Object clone() {
try {
SerialStruct ss = (SerialStruct) super.clone();
ss.attribs = Arrays.copyOf(attribs, attribs.length);
return ss;
} catch (CloneNotSupportedException ex) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
}
/**
* readObject is called to restore the state of the {@code SerialStruct} from
* a stream.
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField fields = s.readFields();
Object[] tmp = (Object[])fields.get("attribs", null);
attribs = tmp == null ? null : tmp.clone();
SQLTypeName = (String)fields.get("SQLTypeName", null);
}
/**
* writeObject is called to save the state of the {@code SerialStruct}
* to a stream.
*/
private void writeObject(ObjectOutputStream s)
throws IOException, ClassNotFoundException {
ObjectOutputStream.PutField fields = s.putFields();
fields.put("attribs", attribs);
fields.put("SQLTypeName", SQLTypeName);
s.writeFields();
}
/**
* The identifier that assists in the serialization of this
* <code>SerialStruct</code> object.
*/
static final long serialVersionUID = -8322445504027483372L;
}

View file

@ -0,0 +1,239 @@
<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR"
content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]">
<!--
Copyright (c) 2003, 2006, 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.
-->
<title>javax.sql.rowset.serial</title>
</head>
<body bgcolor="#ffffff">
Provides utility classes to allow serializable mappings between SQL types
and data types in the Java programming language.
<p> Standard JDBC <code>RowSet</code> implementations may use these utility
classes to
assist in the serialization of disconnected <code>RowSet</code> objects.
This is useful
when transmitting a disconnected <code>RowSet</code> object over the wire to
a different VM or across layers within an application.<br>
</p>
<h3>1.0 SerialArray</h3>
A serializable mapping in the Java programming language of an SQL ARRAY
value. <br>
<br>
The <code>SerialArray</code> class provides a constructor for creating a <code>SerialArray</code>
instance from an Array object, methods for getting the base type and
the SQL name for the base type, and methods for copying all or part of a
<code>SerialArray</code> object. <br>
<h3>2.0 SerialBlob</h3>
A serializable mapping in the Java programming language of an SQL BLOB
value. <br>
<br>
The <code>SerialBlob</code>class provides a constructor for creating an instance
from a Blob object. Note that the Blob object should have brought the SQL
BLOB value's data over to the client before a <code>SerialBlob</code>object
is constructed from it. The data of an SQL BLOB value can be materialized
on the client as an array of bytes (using the method <code>Blob.getBytes</code>)
or as a stream of uninterpreted bytes (using the method <code>Blob.getBinaryStream</code>).
<br>
<br>
<code>SerialBlob</code> methods make it possible to make a copy of a <code>SerialBlob</code>
object as an array of bytes or as a stream. They also make it possible
to locate a given pattern of bytes or a <code>Blob</code> object within a <code>SerialBlob</code>
object. <br>
<h3>3.0 SerialClob</h3>
A serializable mapping in the Java programming language of an SQL CLOB
value. <br>
<br>
The <code>SerialClob</code> class provides a constructor for creating an instance
from a <code>Clob</code> object. Note that the <code>Clob</code> object should have
brought the SQL CLOB value's data over to the client before a <code>SerialClob</code>
object is constructed from it. The data of an SQL CLOB value can be
materialized on the client as a stream of Unicode characters. <br>
<br>
<code>SerialClob</code> methods make it possible to get a substring from a
<code>SerialClob</code> object or to locate the start of a pattern of characters.
<br>
<h3>5.0 SerialDatalink</h3>
A serializable mapping in the Java programming language of an SQL DATALINK
value. A DATALINK value references a file outside of the underlying data source
that the originating data source manages. <br>
<br>
<code>RowSet</code> implementations can use the method <code>RowSet.getURL()</code> to retrieve
a <code>java.net.URL</code> object, which can be used to manipulate the external data.
<br>
<br>
&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp; java.net.URL url = rowset.getURL(1);</code><br>
<h3>6.0 SerialJavaObject</h3>
A serializable mapping in the Java programming language of an SQL JAVA_OBJECT
value. Assuming the Java object instance implements the Serializable interface,
this simply wraps the serialization process. <br>
<br>
If however, the serialization is not possible in the case where the Java
object is not immediately serializable, this class will attempt to serialize
all non static members to permit the object instance state to be serialized.
Static or transient fields cannot be serialized and attempting to do so
will result in a <code>SerialException</code> being thrown. <br>
<h3>7.0 SerialRef</h3>
A serializable mapping between the SQL REF type and the Java programming
language. <br>
<br>
The <code>SerialRef</code> class provides a constructor for creating a <code>SerialRef</code>
instance from a <code>Ref</code> type and provides methods for getting
and setting the <code>Ref</code> object type. <br>
<h3>8.0 SerialStruct</h3>
A serializable mapping in the Java programming language of an SQL structured
type. Each attribute that is not already serializable is mapped to a serializable
form, and if an attribute is itself a structured type, each of its attributes
that is not already serializable is mapped to a serializable form. <br>
<br>
In addition, if a <code>Map</code> object is passed to one of the constructors or
to the method <code>getAttributes</code>, the structured type is custom mapped
according to the mapping specified in the <code>Map</code> object.
<br>
The <code>SerialStruct</code> class provides a constructor for creating an
instance from a <code>Struct</code> object, a method for retrieving the SQL
type name of the SQL structured type in the database, and methods for retrieving
its attribute values. <br>
<h3>9.0 SQLInputImpl</h3>
An input stream used for custom mapping user-defined types (UDTs). An
<code>SQLInputImpl</code> object is an input stream that contains a stream of
values that are
the attributes of a UDT. This class is used by the driver behind the scenes
when the method <code>getObject</code> is called on an SQL structured or distinct
type that has a custom mapping; a programmer never invokes <code>SQLInputImpl</code>
methods directly. <br>
<br>
The <code>SQLInputImpl</code> class provides a set of reader methods
analogous to the <code>ResultSet</code> getter methods. These methods make it
possible to read the values in an <code>SQLInputImpl</code> object. The method
<code>wasNull</code> is used to determine whether the last value read was SQL NULL.
<br>
<br>
When a constructor or getter method that takes a <code>Map</code> object is called,
the JDBC driver calls the method
<code>SQLData.getSQLType</code> to determine the SQL type of the UDT being custom
mapped. The driver creates an instance of <code>SQLInputImpl</code>, populating it with
the attributes of the UDT. The driver then passes the input stream to the
method <code>SQLData.readSQL</code>, which in turn calls the <code>SQLInputImpl</code>
methods to read the attributes from the input stream. <br>
<h3>10.0 SQLOutputImpl</h3>
The output stream for writing the attributes of a custom mapped user-defined
type (UDT) back to the database. The driver uses this interface internally,
and its methods are never directly invoked by an application programmer.
<br>
<br>
When an application calls the method <code>PreparedStatement.setObject</code>, the
driver checks to see whether the value to be written is a UDT with a custom
mapping. If it is, there will be an entry in a type map containing the Class
object for the class that implements <code>SQLData</code> for this UDT. If the
value to be written is an instance of <code>SQLData</code>, the driver will
create an instance of <code>SQLOutputImpl</code> and pass it to the method
<code>SQLData.writeSQL</code>.
The method <code>writeSQL</code> in turn calls the appropriate <code>SQLOutputImpl</code>
writer methods to write data from the <code>SQLData</code> object to the
<code>SQLOutputImpl</code>
output stream as the representation of an SQL user-defined type.
<h3>Custom Mapping</h3>
The JDBC API provides mechanisms for mapping an SQL structured type or DISTINCT
type to the Java programming language. Typically, a structured type is mapped
to a class, and its attributes are mapped to fields in the class.
(A DISTINCT type can thought of as having one attribute.) However, there are
many other possibilities, and there may be any number of different mappings.
<P>
A programmer defines the mapping by implementing the interface <code>SQLData</code>.
For example, if an SQL structured type named AUTHORS has the attributes NAME,
TITLE, and PUBLISHER, it could be mapped to a Java class named Authors. The
Authors class could have the fields name, title, and publisher, to which the
attributes of AUTHORS are mapped. In such a case, the implementation of
<code>SQLData</code> could look like the following:
<PRE>
public class Authors implements SQLData {
public String name;
public String title;
public String publisher;
private String sql_type;
public String getSQLTypeName() {
return sql_type;
}
public void readSQL(SQLInput stream, String type)
throws SQLException {
sql_type = type;
name = stream.readString();
title = stream.readString();
publisher = stream.readString();
}
public void writeSQL(SQLOutput stream) throws SQLException {
stream.writeString(name);
stream.writeString(title);
stream.writeString(publisher);
}
}
</PRE>
A <code>java.util.Map</code> object is used to associate the SQL structured
type with its mapping to the class <code>Authors</code>. The following code fragment shows
how a <code>Map</code> object might be created and given an entry associating
<code>AUTHORS</code> and <code>Authors</code>.
<PRE>
java.util.Map map = new java.util.HashMap();
map.put("SCHEMA_NAME.AUTHORS", Class.forName("Authors");
</PRE>
The <code>Map</code> object <i>map</i> now contains an entry with the
fully qualified name of the SQL structured type and the <code>Class</code>
object for the class <code>Authors</code>. It can be passed to a method
to tell the driver how to map <code>AUTHORS</code> to <code>Authors</code>.
<P>
For a disconnected <code>RowSet</code> object, custom mapping can be done
only when a <code>Map</code> object is passed to the method or constructor
that will be doing the custom mapping. The situation is different for
connected <code>RowSet</code> objects because they maintain a connection
with the data source. A method that does custom mapping and is called by
a disconnected <code>RowSet</code> object may use the <code>Map</code>
object that is associated with the <code>Connection</code> object being
used. So, in other words, if no map is specified, the connection's type
map can be used by default.
<br>
</body>
</html>

View file

@ -0,0 +1,958 @@
/*
* Copyright (c) 2003, 2013, 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.spi;
import java.util.logging.*;
import java.util.*;
import java.sql.*;
import javax.sql.*;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import javax.naming.*;
import sun.reflect.misc.ReflectUtil;
/**
* The Service Provider Interface (SPI) mechanism that generates <code>SyncProvider</code>
* instances to be used by disconnected <code>RowSet</code> objects.
* The <code>SyncProvider</code> instances in turn provide the
* <code>javax.sql.RowSetReader</code> object the <code>RowSet</code> object
* needs to populate itself with data and the
* <code>javax.sql.RowSetWriter</code> object it needs to
* propagate changes to its
* data back to the underlying data source.
* <P>
* Because the methods in the <code>SyncFactory</code> class are all static,
* there is only one <code>SyncFactory</code> object
* per Java VM at any one time. This ensures that there is a single source from which a
* <code>RowSet</code> implementation can obtain its <code>SyncProvider</code>
* implementation.
*
* <h3>1.0 Overview</h3>
* The <code>SyncFactory</code> class provides an internal registry of available
* synchronization provider implementations (<code>SyncProvider</code> objects).
* This registry may be queried to determine which
* synchronization providers are available.
* The following line of code gets an enumeration of the providers currently registered.
* <PRE>
* java.util.Enumeration e = SyncFactory.getRegisteredProviders();
* </PRE>
* All standard <code>RowSet</code> implementations must provide at least two providers:
* <UL>
* <LI>an optimistic provider for use with a <code>CachedRowSet</code> implementation
* or an implementation derived from it
* <LI>an XML provider, which is used for reading and writing XML, such as with
* <code>WebRowSet</code> objects
* </UL>
* Note that the JDBC RowSet Implementations include the <code>SyncProvider</code>
* implementations <code>RIOptimisticProvider</code> and <code>RIXmlProvider</code>,
* which satisfy this requirement.
* <P>
* The <code>SyncFactory</code> class provides accessor methods to assist
* applications in determining which synchronization providers are currently
* registered with the <code>SyncFactory</code>.
* <p>
* Other methods let <code>RowSet</code> persistence providers be
* registered or de-registered with the factory mechanism. This
* allows additional synchronization provider implementations to be made
* available to <code>RowSet</code> objects at run time.
* <p>
* Applications can apply a degree of filtering to determine the level of
* synchronization that a <code>SyncProvider</code> implementation offers.
* The following criteria determine whether a provider is
* made available to a <code>RowSet</code> object:
* <ol>
* <li>If a particular provider is specified by a <code>RowSet</code> object, and
* the <code>SyncFactory</code> does not contain a reference to this provider,
* a <code>SyncFactoryException</code> is thrown stating that the synchronization
* provider could not be found.
*
* <li>If a <code>RowSet</code> implementation is instantiated with a specified
* provider and the specified provider has been properly registered, the
* requested provider is supplied. Otherwise a <code>SyncFactoryException</code>
* is thrown.
*
* <li>If a <code>RowSet</code> object does not specify a
* <code>SyncProvider</code> implementation and no additional
* <code>SyncProvider</code> implementations are available, the reference
* implementation providers are supplied.
* </ol>
* <h3>2.0 Registering <code>SyncProvider</code> Implementations</h3>
* <p>
* Both vendors and developers can register <code>SyncProvider</code>
* implementations using one of the following mechanisms.
* <ul>
* <LI><B>Using the command line</B><BR>
* The name of the provider is supplied on the command line, which will add
* the provider to the system properties.
* For example:
* <PRE>
* -Drowset.provider.classname=com.fred.providers.HighAvailabilityProvider
* </PRE>
* <li><b>Using the Standard Properties File</b><BR>
* The reference implementation is targeted
* to ship with J2SE 1.5, which will include an additional resource file
* that may be edited by hand. Here is an example of the properties file
* included in the reference implementation:
* <PRE>
* #Default JDBC RowSet sync providers listing
* #
*
* # Optimistic synchronization provider
* rowset.provider.classname.0=com.sun.rowset.providers.RIOptimisticProvider
* rowset.provider.vendor.0=Oracle Corporation
* rowset.provider.version.0=1.0
*
* # XML Provider using standard XML schema
* rowset.provider.classname.1=com.sun.rowset.providers.RIXMLProvider
* rowset.provider.vendor.1=Oracle Corporation
* rowset.provider.version.1=1.0
* </PRE>
* The <code>SyncFactory</code> checks this file and registers the
* <code>SyncProvider</code> implementations that it contains. A
* developer or vendor can add other implementations to this file.
* For example, here is a possible addition:
* <PRE>
* rowset.provider.classname.2=com.fred.providers.HighAvailabilityProvider
* rowset.provider.vendor.2=Fred, Inc.
* rowset.provider.version.2=1.0
* </PRE>
*
* <li><b>Using a JNDI Context</b><BR>
* Available providers can be registered on a JNDI
* context, and the <code>SyncFactory</code> will attempt to load
* <code>SyncProvider</code> implementations from that JNDI context.
* For example, the following code fragment registers a provider implementation
* on a JNDI context. This is something a deployer would normally do. In this
* example, <code>MyProvider</code> is being registered on a CosNaming
* namespace, which is the namespace used by J2EE resources.
* <PRE>
* import javax.naming.*;
*
* Hashtable svrEnv = new Hashtable();
* srvEnv.put(Context.INITIAL_CONTEXT_FACTORY, "CosNaming");
*
* Context ctx = new InitialContext(svrEnv);
* com.fred.providers.MyProvider = new MyProvider();
* ctx.rebind("providers/MyProvider", syncProvider);
* </PRE>
* </ul>
* Next, an application will register the JNDI context with the
* <code>SyncFactory</code> instance. This allows the <code>SyncFactory</code>
* to browse within the JNDI context looking for <code>SyncProvider</code>
* implementations.
* <PRE>
* Hashtable appEnv = new Hashtable();
* appEnv.put(Context.INITIAL_CONTEXT_FACTORY, "CosNaming");
* appEnv.put(Context.PROVIDER_URL, "iiop://hostname/providers");
* Context ctx = new InitialContext(appEnv);
*
* SyncFactory.registerJNDIContext(ctx);
* </PRE>
* If a <code>RowSet</code> object attempts to obtain a <code>MyProvider</code>
* object, the <code>SyncFactory</code> will try to locate it. First it searches
* for it in the system properties, then it looks in the resource files, and
* finally it checks the JNDI context that has been set. The <code>SyncFactory</code>
* instance verifies that the requested provider is a valid extension of the
* <code>SyncProvider</code> abstract class and then gives it to the
* <code>RowSet</code> object. In the following code fragment, a new
* <code>CachedRowSet</code> object is created and initialized with
* <i>env</i>, which contains the binding to <code>MyProvider</code>.
* <PRE>
* Hashtable env = new Hashtable();
* env.put(SyncFactory.ROWSET_SYNC_PROVIDER, "com.fred.providers.MyProvider");
* CachedRowSet crs = new com.sun.rowset.CachedRowSetImpl(env);
* </PRE>
* Further details on these mechanisms are available in the
* <code>javax.sql.rowset.spi</code> package specification.
*
* @author Jonathan Bruce
* @see javax.sql.rowset.spi.SyncProvider
* @see javax.sql.rowset.spi.SyncFactoryException
* @since 1.5
*/
public class SyncFactory {
/**
* Creates a new <code>SyncFactory</code> object, which is the singleton
* instance.
* Having a private constructor guarantees that no more than
* one <code>SyncProvider</code> object can exist at a time.
*/
private SyncFactory() {
}
/**
* The standard property-id for a synchronization provider implementation
* name.
*/
public static final String ROWSET_SYNC_PROVIDER =
"rowset.provider.classname";
/**
* The standard property-id for a synchronization provider implementation
* vendor name.
*/
public static final String ROWSET_SYNC_VENDOR =
"rowset.provider.vendor";
/**
* The standard property-id for a synchronization provider implementation
* version tag.
*/
public static final String ROWSET_SYNC_PROVIDER_VERSION =
"rowset.provider.version";
/**
* The standard resource file name.
*/
private static String ROWSET_PROPERTIES = "rowset.properties";
/**
* Permission required to invoke setJNDIContext and setLogger
*/
private static final SQLPermission SET_SYNCFACTORY_PERMISSION =
new SQLPermission("setSyncFactory");
/**
* The initial JNDI context where <code>SyncProvider</code> implementations can
* be stored and from which they can be invoked.
*/
private static Context ic;
/**
* The <code>Logger</code> object to be used by the <code>SyncFactory</code>.
*/
private static volatile Logger rsLogger;
/**
* The registry of available <code>SyncProvider</code> implementations.
* See section 2.0 of the class comment for <code>SyncFactory</code> for an
* explanation of how a provider can be added to this registry.
*/
private static Hashtable<String, SyncProvider> implementations;
/**
* Adds the given synchronization provider to the factory register. Guidelines
* are provided in the <code>SyncProvider</code> specification for the
* required naming conventions for <code>SyncProvider</code>
* implementations.
* <p>
* Synchronization providers bound to a JNDI context can be
* registered by binding a SyncProvider instance to a JNDI namespace.
*
* <pre>
* {@code
* SyncProvider p = new MySyncProvider();
* InitialContext ic = new InitialContext();
* ic.bind ("jdbc/rowset/MySyncProvider", p);
* } </pre>
*
* Furthermore, an initial JNDI context should be set with the
* <code>SyncFactory</code> using the <code>setJNDIContext</code> method.
* The <code>SyncFactory</code> leverages this context to search for
* available <code>SyncProvider</code> objects bound to the JNDI
* context and its child nodes.
*
* @param providerID A <code>String</code> object with the unique ID of the
* synchronization provider being registered
* @throws SyncFactoryException if an attempt is made to supply an empty
* or null provider name
* @see #setJNDIContext
*/
public static synchronized void registerProvider(String providerID)
throws SyncFactoryException {
ProviderImpl impl = new ProviderImpl();
impl.setClassname(providerID);
initMapIfNecessary();
implementations.put(providerID, impl);
}
/**
* Returns the <code>SyncFactory</code> singleton.
*
* @return the <code>SyncFactory</code> instance
*/
public static SyncFactory getSyncFactory() {
/*
* Using Initialization on Demand Holder idiom as
* Effective Java 2nd Edition,ITEM 71, indicates it is more performant
* than the Double-Check Locking idiom.
*/
return SyncFactoryHolder.factory;
}
/**
* Removes the designated currently registered synchronization provider from the
* Factory SPI register.
*
* @param providerID The unique-id of the synchronization provider
* @throws SyncFactoryException If an attempt is made to
* unregister a SyncProvider implementation that was not registered.
*/
public static synchronized void unregisterProvider(String providerID)
throws SyncFactoryException {
initMapIfNecessary();
if (implementations.containsKey(providerID)) {
implementations.remove(providerID);
}
}
private static String colon = ":";
private static String strFileSep = "/";
private static synchronized void initMapIfNecessary() throws SyncFactoryException {
// Local implementation class names and keys from Properties
// file, translate names into Class objects using Class.forName
// and store mappings
final Properties properties = new Properties();
if (implementations == null) {
implementations = new Hashtable<>();
try {
// check if user is supplying his Synchronisation Provider
// Implementation if not using Oracle's implementation.
// properties.load(new FileInputStream(ROWSET_PROPERTIES));
// The rowset.properties needs to be in jdk/jre/lib when
// integrated with jdk.
// else it should be picked from -D option from command line.
// -Drowset.properties will add to standard properties. Similar
// keys will over-write
/*
* Dependent on application
*/
String strRowsetProperties;
try {
strRowsetProperties = AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty("rowset.properties");
}
}, null, new PropertyPermission("rowset.properties", "read"));
} catch (Exception ex) {
System.out.println("errorget rowset.properties: " + ex);
strRowsetProperties = null;
};
if (strRowsetProperties != null) {
// Load user's implementation of SyncProvider
// here. -Drowset.properties=/abc/def/pqr.txt
ROWSET_PROPERTIES = strRowsetProperties;
try (FileInputStream fis = new FileInputStream(ROWSET_PROPERTIES)) {
properties.load(fis);
}
parseProperties(properties);
}
/*
* Always available
*/
ROWSET_PROPERTIES = "javax" + strFileSep + "sql" +
strFileSep + "rowset" + strFileSep +
"rowset.properties";
try {
AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> {
InputStream in = SyncFactory.class.getModule().getResourceAsStream(ROWSET_PROPERTIES);
if (in == null) {
throw new SyncFactoryException("Resource " + ROWSET_PROPERTIES + " not found");
}
try (in) {
properties.load(in);
}
return null;
});
} catch (PrivilegedActionException ex) {
Throwable e = ex.getException();
if (e instanceof SyncFactoryException) {
throw (SyncFactoryException) e;
} else {
SyncFactoryException sfe = new SyncFactoryException();
sfe.initCause(ex.getException());
throw sfe;
}
}
parseProperties(properties);
// removed else, has properties should sum together
} catch (FileNotFoundException e) {
throw new SyncFactoryException("Cannot locate properties file: " + e);
} catch (IOException e) {
throw new SyncFactoryException("IOException: " + e);
}
/*
* Now deal with -Drowset.provider.classname
* load additional properties from -D command line
*/
properties.clear();
String providerImpls;
try {
providerImpls = AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty(ROWSET_SYNC_PROVIDER);
}
}, null, new PropertyPermission(ROWSET_SYNC_PROVIDER, "read"));
} catch (Exception ex) {
providerImpls = null;
}
if (providerImpls != null) {
int i = 0;
if (providerImpls.indexOf(colon) > 0) {
StringTokenizer tokenizer = new StringTokenizer(providerImpls, colon);
while (tokenizer.hasMoreElements()) {
properties.put(ROWSET_SYNC_PROVIDER + "." + i, tokenizer.nextToken());
i++;
}
} else {
properties.put(ROWSET_SYNC_PROVIDER, providerImpls);
}
parseProperties(properties);
}
}
}
/**
* The internal debug switch.
*/
private static boolean debug = false;
/**
* Internal registry count for the number of providers contained in the
* registry.
*/
private static int providerImplIndex = 0;
/**
* Internal handler for all standard property parsing. Parses standard
* ROWSET properties and stores lazy references into the internal registry.
*/
private static void parseProperties(Properties p) {
ProviderImpl impl = null;
String key = null;
String[] propertyNames = null;
for (Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) {
String str = (String) e.nextElement();
int w = str.length();
if (str.startsWith(SyncFactory.ROWSET_SYNC_PROVIDER)) {
impl = new ProviderImpl();
impl.setIndex(providerImplIndex++);
if (w == (SyncFactory.ROWSET_SYNC_PROVIDER).length()) {
// no property index has been set.
propertyNames = getPropertyNames(false);
} else {
// property index has been set.
propertyNames = getPropertyNames(true, str.substring(w - 1));
}
key = p.getProperty(propertyNames[0]);
impl.setClassname(key);
impl.setVendor(p.getProperty(propertyNames[1]));
impl.setVersion(p.getProperty(propertyNames[2]));
implementations.put(key, impl);
}
}
}
/**
* Used by the parseProperties methods to disassemble each property tuple.
*/
private static String[] getPropertyNames(boolean append) {
return getPropertyNames(append, null);
}
/**
* Disassembles each property and its associated value. Also handles
* overloaded property names that contain indexes.
*/
private static String[] getPropertyNames(boolean append,
String propertyIndex) {
String dot = ".";
String[] propertyNames =
new String[]{SyncFactory.ROWSET_SYNC_PROVIDER,
SyncFactory.ROWSET_SYNC_VENDOR,
SyncFactory.ROWSET_SYNC_PROVIDER_VERSION};
if (append) {
for (int i = 0; i < propertyNames.length; i++) {
propertyNames[i] = propertyNames[i] +
dot +
propertyIndex;
}
return propertyNames;
} else {
return propertyNames;
}
}
/**
* Internal debug method that outputs the registry contents.
*/
private static void showImpl(ProviderImpl impl) {
System.out.println("Provider implementation:");
System.out.println("Classname: " + impl.getClassname());
System.out.println("Vendor: " + impl.getVendor());
System.out.println("Version: " + impl.getVersion());
System.out.println("Impl index: " + impl.getIndex());
}
/**
* Returns the <code>SyncProvider</code> instance identified by <i>providerID</i>.
*
* @param providerID the unique identifier of the provider
* @return a <code>SyncProvider</code> implementation
* @throws SyncFactoryException If the SyncProvider cannot be found,
* the providerID is {@code null}, or
* some error was encountered when trying to invoke this provider.
*/
public static SyncProvider getInstance(String providerID)
throws SyncFactoryException {
if(providerID == null) {
throw new SyncFactoryException("The providerID cannot be null");
}
initMapIfNecessary(); // populate HashTable
initJNDIContext(); // check JNDI context for any additional bindings
ProviderImpl impl = (ProviderImpl) implementations.get(providerID);
if (impl == null) {
// Requested SyncProvider is unavailable. Return default provider.
return new com.sun.rowset.providers.RIOptimisticProvider();
}
try {
ReflectUtil.checkPackageAccess(providerID);
} catch (java.security.AccessControlException e) {
SyncFactoryException sfe = new SyncFactoryException();
sfe.initCause(e);
throw sfe;
}
// Attempt to invoke classname from registered SyncProvider list
Class<?> c = null;
try {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
/**
* The SyncProvider implementation of the user will be in
* the classpath. We need to find the ClassLoader which loads
* this SyncFactory and try to load the SyncProvider class from
* there.
**/
c = Class.forName(providerID, true, cl);
@SuppressWarnings("deprecation")
Object result = c.newInstance();
return (SyncProvider)result;
} catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
throw new SyncFactoryException("IllegalAccessException: " + e.getMessage());
}
}
/**
* Returns an Enumeration of currently registered synchronization
* providers. A <code>RowSet</code> implementation may use any provider in
* the enumeration as its <code>SyncProvider</code> object.
* <p>
* At a minimum, the reference synchronization provider allowing
* RowSet content data to be stored using a JDBC driver should be
* possible.
*
* @return Enumeration A enumeration of available synchronization
* providers that are registered with this Factory
* @throws SyncFactoryException If an error occurs obtaining the registered
* providers
*/
public static Enumeration<SyncProvider> getRegisteredProviders()
throws SyncFactoryException {
initMapIfNecessary();
// return a collection of classnames
// of type SyncProvider
return implementations.elements();
}
/**
* Sets the logging object to be used by the <code>SyncProvider</code>
* implementation provided by the <code>SyncFactory</code>. All
* <code>SyncProvider</code> implementations can log their events to
* this object and the application can retrieve a handle to this
* object using the <code>getLogger</code> method.
* <p>
* This method checks to see that there is an {@code SQLPermission}
* object which grants the permission {@code setSyncFactory}
* before allowing the method to succeed. If a
* {@code SecurityManager} exists and its
* {@code checkPermission} method denies calling {@code setLogger},
* this method throws a
* {@code java.lang.SecurityException}.
*
* @param logger A Logger object instance
* @throws java.lang.SecurityException if a security manager exists and its
* {@code checkPermission} method denies calling {@code setLogger}
* @throws NullPointerException if the logger is null
* @see SecurityManager#checkPermission
*/
public static void setLogger(Logger logger) {
SecurityManager sec = System.getSecurityManager();
if (sec != null) {
sec.checkPermission(SET_SYNCFACTORY_PERMISSION);
}
if(logger == null){
throw new NullPointerException("You must provide a Logger");
}
rsLogger = logger;
}
/**
* Sets the logging object that is used by <code>SyncProvider</code>
* implementations provided by the <code>SyncFactory</code> SPI. All
* <code>SyncProvider</code> implementations can log their events
* to this object and the application can retrieve a handle to this
* object using the <code>getLogger</code> method.
* <p>
* This method checks to see that there is an {@code SQLPermission}
* object which grants the permission {@code setSyncFactory}
* before allowing the method to succeed. If a
* {@code SecurityManager} exists and its
* {@code checkPermission} method denies calling {@code setLogger},
* this method throws a
* {@code java.lang.SecurityException}.
*
* @param logger a Logger object instance
* @param level a Level object instance indicating the degree of logging
* required
* @throws java.lang.SecurityException if a security manager exists and its
* {@code checkPermission} method denies calling {@code setLogger}
* @throws NullPointerException if the logger is null
* @see SecurityManager#checkPermission
* @see LoggingPermission
*/
public static void setLogger(Logger logger, Level level) {
// singleton
SecurityManager sec = System.getSecurityManager();
if (sec != null) {
sec.checkPermission(SET_SYNCFACTORY_PERMISSION);
}
if(logger == null){
throw new NullPointerException("You must provide a Logger");
}
logger.setLevel(level);
rsLogger = logger;
}
/**
* Returns the logging object for applications to retrieve
* synchronization events posted by SyncProvider implementations.
* @return The {@code Logger} that has been specified for use by
* {@code SyncProvider} implementations
* @throws SyncFactoryException if no logging object has been set.
*/
public static Logger getLogger() throws SyncFactoryException {
Logger result = rsLogger;
// only one logger per session
if (result == null) {
throw new SyncFactoryException("(SyncFactory) : No logger has been set");
}
return result;
}
/**
* Sets the initial JNDI context from which SyncProvider implementations
* can be retrieved from a JNDI namespace
* <p>
* This method checks to see that there is an {@code SQLPermission}
* object which grants the permission {@code setSyncFactory}
* before allowing the method to succeed. If a
* {@code SecurityManager} exists and its
* {@code checkPermission} method denies calling {@code setJNDIContext},
* this method throws a
* {@code java.lang.SecurityException}.
*
* @param ctx a valid JNDI context
* @throws SyncFactoryException if the supplied JNDI context is null
* @throws java.lang.SecurityException if a security manager exists and its
* {@code checkPermission} method denies calling {@code setJNDIContext}
* @see SecurityManager#checkPermission
*/
public static synchronized void setJNDIContext(javax.naming.Context ctx)
throws SyncFactoryException {
SecurityManager sec = System.getSecurityManager();
if (sec != null) {
sec.checkPermission(SET_SYNCFACTORY_PERMISSION);
}
if (ctx == null) {
throw new SyncFactoryException("Invalid JNDI context supplied");
}
ic = ctx;
}
/**
* Controls JNDI context initialization.
*
* @throws SyncFactoryException if an error occurs parsing the JNDI context
*/
private static synchronized void initJNDIContext() throws SyncFactoryException {
if ((ic != null) && (lazyJNDICtxRefresh == false)) {
try {
parseProperties(parseJNDIContext());
lazyJNDICtxRefresh = true; // touch JNDI namespace once.
} catch (NamingException e) {
e.printStackTrace();
throw new SyncFactoryException("SPI: NamingException: " + e.getExplanation());
} catch (Exception e) {
e.printStackTrace();
throw new SyncFactoryException("SPI: Exception: " + e.getMessage());
}
}
}
/**
* Internal switch indicating whether the JNDI namespace should be re-read.
*/
private static boolean lazyJNDICtxRefresh = false;
/**
* Parses the set JNDI Context and passes bindings to the enumerateBindings
* method when complete.
*/
private static Properties parseJNDIContext() throws NamingException {
NamingEnumeration<?> bindings = ic.listBindings("");
Properties properties = new Properties();
// Hunt one level below context for available SyncProvider objects
enumerateBindings(bindings, properties);
return properties;
}
/**
* Scans each binding on JNDI context and determines if any binding is an
* instance of SyncProvider, if so, add this to the registry and continue to
* scan the current context using a re-entrant call to this method until all
* bindings have been enumerated.
*/
private static void enumerateBindings(NamingEnumeration<?> bindings,
Properties properties) throws NamingException {
boolean syncProviderObj = false; // move to parameters ?
try {
Binding bd = null;
Object elementObj = null;
String element = null;
while (bindings.hasMore()) {
bd = (Binding) bindings.next();
element = bd.getName();
elementObj = bd.getObject();
if (!(ic.lookup(element) instanceof Context)) {
// skip directories/sub-contexts
if (ic.lookup(element) instanceof SyncProvider) {
syncProviderObj = true;
}
}
if (syncProviderObj) {
SyncProvider sync = (SyncProvider) elementObj;
properties.put(SyncFactory.ROWSET_SYNC_PROVIDER,
sync.getProviderID());
syncProviderObj = false; // reset
}
}
} catch (javax.naming.NotContextException e) {
bindings.next();
// Re-entrant call into method
enumerateBindings(bindings, properties);
}
}
/**
* Lazy initialization Holder class used by {@code getSyncFactory}
*/
private static class SyncFactoryHolder {
static final SyncFactory factory = new SyncFactory();
}
}
/**
* Internal class that defines the lazy reference construct for each registered
* SyncProvider implementation.
*/
class ProviderImpl extends SyncProvider {
private String className = null;
private String vendorName = null;
private String ver = null;
private int index;
public void setClassname(String classname) {
className = classname;
}
public String getClassname() {
return className;
}
public void setVendor(String vendor) {
vendorName = vendor;
}
public String getVendor() {
return vendorName;
}
public void setVersion(String providerVer) {
ver = providerVer;
}
public String getVersion() {
return ver;
}
public void setIndex(int i) {
index = i;
}
public int getIndex() {
return index;
}
public int getDataSourceLock() throws SyncProviderException {
int dsLock = 0;
try {
dsLock = SyncFactory.getInstance(className).getDataSourceLock();
} catch (SyncFactoryException sfEx) {
throw new SyncProviderException(sfEx.getMessage());
}
return dsLock;
}
public int getProviderGrade() {
int grade = 0;
try {
grade = SyncFactory.getInstance(className).getProviderGrade();
} catch (SyncFactoryException sfEx) {
//
}
return grade;
}
public String getProviderID() {
return className;
}
/*
public javax.sql.RowSetInternal getRowSetInternal() {
try
{
return SyncFactory.getInstance(className).getRowSetInternal();
} catch(SyncFactoryException sfEx) {
//
}
}
*/
public javax.sql.RowSetReader getRowSetReader() {
RowSetReader rsReader = null;
try {
rsReader = SyncFactory.getInstance(className).getRowSetReader();
} catch (SyncFactoryException sfEx) {
//
}
return rsReader;
}
public javax.sql.RowSetWriter getRowSetWriter() {
RowSetWriter rsWriter = null;
try {
rsWriter = SyncFactory.getInstance(className).getRowSetWriter();
} catch (SyncFactoryException sfEx) {
//
}
return rsWriter;
}
public void setDataSourceLock(int param)
throws SyncProviderException {
try {
SyncFactory.getInstance(className).setDataSourceLock(param);
} catch (SyncFactoryException sfEx) {
throw new SyncProviderException(sfEx.getMessage());
}
}
public int supportsUpdatableView() {
int view = 0;
try {
view = SyncFactory.getInstance(className).supportsUpdatableView();
} catch (SyncFactoryException sfEx) {
//
}
return view;
}
}

View file

@ -0,0 +1,59 @@
/*
* Copyright (c) 2003, 2004, 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.spi;
import java.sql.SQLException;
/**
* Indicates an error with <code>SyncFactory</code> mechanism. A disconnected
* RowSet implementation cannot be used without a <code>SyncProvider</code>
* being successfully instantiated
*
* @author Jonathan Bruce
* @see javax.sql.rowset.spi.SyncFactory
* @see javax.sql.rowset.spi.SyncFactoryException
* @since 1.5
*/
public class SyncFactoryException extends java.sql.SQLException {
/**
* Creates new <code>SyncFactoryException</code> without detail message.
*/
public SyncFactoryException() {
}
/**
* Constructs an <code>SyncFactoryException</code> with the specified
* detail message.
*
* @param msg the detail message.
*/
public SyncFactoryException(String msg) {
super(msg);
}
static final long serialVersionUID = -4354595476433200352L;
}

View file

@ -0,0 +1,431 @@
/*
* Copyright (c) 2003, 2013, 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.spi;
import javax.sql.*;
/**
* The synchronization mechanism that provides reader/writer capabilities for
* disconnected <code>RowSet</code> objects.
* A <code>SyncProvider</code> implementation is a class that extends the
* <code>SyncProvider</code> abstract class.
* <P>
* A <code>SyncProvider</code> implementation is
* identified by a unique ID, which is its fully qualified class name.
* This name must be registered with the
* <code>SyncFactory</code> SPI, thus making the implementation available to
* all <code>RowSet</code> implementations.
* The factory mechanism in the reference implementation uses this name to instantiate
* the implementation, which can then provide a <code>RowSet</code> object with its
* reader (a <code>javax.sql.RowSetReader</code> object) and its writer (a
* <code>javax.sql.RowSetWriter</code> object).
* <P>
* The Jdbc <code>RowSet</code> Implementations specification provides two
* reference implementations of the <code>SyncProvider</code> abstract class:
* <code>RIOptimisticProvider</code> and <code>RIXMLProvider</code>.
* The <code>RIOptimisticProvider</code> can set any <code>RowSet</code>
* implementation with a <code>RowSetReader</code> object and a
* <code>RowSetWriter</code> object. However, only the <code>RIXMLProvider</code>
* implementation can set an <code>XmlReader</code> object and an
* <code>XmlWriter</code> object. A <code>WebRowSet</code> object uses the
* <code>XmlReader</code> object to read data in XML format to populate itself with that
* data. It uses the <code>XmlWriter</code> object to write itself to a stream or
* <code>java.io.Writer</code> object in XML format.
*
* <h3>1.0 Naming Convention for Implementations</h3>
* As a guide to naming <code>SyncProvider</code>
* implementations, the following should be noted:
* <UL>
* <li>The name for a <code>SyncProvider</code> implementation
* is its fully qualified class name.
* <li>It is recommended that vendors supply a
* <code>SyncProvider</code> implementation in a package named <code>providers</code>.
* </UL>
* <p>
* For instance, if a vendor named Fred, Inc. offered a
* <code>SyncProvider</code> implementation, you could have the following:
* <PRE>
* Vendor name: Fred, Inc.
* Domain name of vendor: com.fred
* Package name: com.fred.providers
* SyncProvider implementation class name: HighAvailabilityProvider
*
* Fully qualified class name of SyncProvider implementation:
* com.fred.providers.HighAvailabilityProvider
* </PRE>
* <P>
* The following line of code uses the fully qualified name to register
* this implementation with the <code>SyncFactory</code> static instance.
* <PRE>
* SyncFactory.registerProvider(
* "com.fred.providers.HighAvailabilityProvider");
* </PRE>
* <P>
* The default <code>SyncProvider</code> object provided with the reference
* implementation uses the following name:
* <pre>
* com.sun.rowset.providers.RIOptimisticProvider
* </pre>
* <p>
* A vendor can register a <code>SyncProvider</code> implementation class name
* with Oracle Corporation by sending email to jdbc@sun.com.
* Oracle will maintain a database listing the
* available <code>SyncProvider</code> implementations for use with compliant
* <code>RowSet</code> implementations. This database will be similar to the
* one already maintained to list available JDBC drivers.
* <P>
* Vendors should refer to the reference implementation synchronization
* providers for additional guidance on how to implement a new
* <code>SyncProvider</code> implementation.
*
* <h3>2.0 How a <code>RowSet</code> Object Gets Its Provider</h3>
*
* A disconnected <code>Rowset</code> object may get access to a
* <code>SyncProvider</code> object in one of the following two ways:
* <UL>
* <LI>Using a constructor<BR>
* <PRE>
* CachedRowSet crs = new CachedRowSet(
* "com.fred.providers.HighAvailabilitySyncProvider");
* </PRE>
* <LI>Using the <code>setSyncProvider</code> method
* <PRE>
* CachedRowSet crs = new CachedRowSet();
* crs.setSyncProvider("com.fred.providers.HighAvailabilitySyncProvider");
* </PRE>
* </UL>
* <p>
* By default, the reference implementations of the <code>RowSet</code> synchronization
* providers are always available to the Java platform.
* If no other pluggable synchronization providers have been correctly
* registered, the <code>SyncFactory</code> will automatically generate
* an instance of the default <code>SyncProvider</code> reference implementation.
* Thus, in the preceding code fragment, if no implementation named
* <code>com.fred.providers.HighAvailabilitySyncProvider</code> has been
* registered with the <code>SyncFactory</code> instance, <i>crs</i> will be
* assigned the default provider in the reference implementation, which is
* <code>com.sun.rowset.providers.RIOptimisticProvider</code>.
*
* <h3>3.0 Violations and Synchronization Issues</h3>
* If an update between a disconnected <code>RowSet</code> object
* and a data source violates
* the original query or the underlying data source constraints, this will
* result in undefined behavior for all disconnected <code>RowSet</code> implementations
* and their designated <code>SyncProvider</code> implementations.
* Not defining the behavior when such violations occur offers greater flexibility
* for a <code>SyncProvider</code>
* implementation to determine its own best course of action.
* <p>
* A <code>SyncProvider</code> implementation
* may choose to implement a specific handler to
* handle a subset of query violations.
* However if an original query violation or a more general data source constraint
* violation is not handled by the <code>SyncProvider</code> implementation,
* all <code>SyncProvider</code>
* objects must throw a <code>SyncProviderException</code>.
*
* <h3>4.0 Updatable SQL VIEWs</h3>
* It is possible for any disconnected or connected <code>RowSet</code> object to be populated
* from an SQL query that is formulated originally from an SQL <code>VIEW</code>.
* While in many cases it is possible for an update to be performed to an
* underlying view, such an update requires additional metadata, which may vary.
* The <code>SyncProvider</code> class provides two constants to indicate whether
* an implementation supports updating an SQL <code>VIEW</code>.
* <ul>
* <li><code><b>NONUPDATABLE_VIEW_SYNC</b></code> - Indicates that a <code>SyncProvider</code>
* implementation does not support synchronization with an SQL <code>VIEW</code> as the
* underlying source of data for the <code>RowSet</code> object.
* <li><code><b>UPDATABLE_VIEW_SYNC</b></code> - Indicates that a
* <code>SyncProvider</code> implementation
* supports synchronization with an SQL <code>VIEW</code> as the underlying source
* of data.
* </ul>
* <P>
* The default is for a <code>RowSet</code> object not to be updatable if it was
* populated with data from an SQL <code>VIEW</code>.
*
* <h3>5.0 <code>SyncProvider</code> Constants</h3>
* The <code>SyncProvider</code> class provides three sets of constants that
* are used as return values or parameters for <code>SyncProvider</code> methods.
* <code>SyncProvider</code> objects may be implemented to perform synchronization
* between a <code>RowSet</code> object and its underlying data source with varying
* degrees of care. The first group of constants indicate how synchronization
* is handled. For example, <code>GRADE_NONE</code> indicates that a
* <code>SyncProvider</code> object will not take any care to see what data is
* valid and will simply write the <code>RowSet</code> data to the data source.
* <code>GRADE_MODIFIED_AT_COMMIT</code> indicates that the provider will check
* only modified data for validity. Other grades check all data for validity
* or set locks when data is modified or loaded.
* <OL>
* <LI>Constants to indicate the synchronization grade of a
* <code>SyncProvider</code> object
* <UL>
* <LI>SyncProvider.GRADE_NONE
* <LI>SyncProvider.GRADE_MODIFIED_AT_COMMIT
* <LI>SyncProvider.GRADE_CHECK_ALL_AT_COMMIT
* <LI>SyncProvider.GRADE_LOCK_WHEN_MODIFIED
* <LI>SyncProvider.GRADE_LOCK_WHEN_LOADED
* </UL>
* <LI>Constants to indicate what locks are set on the data source
* <UL>
* <LI>SyncProvider.DATASOURCE_NO_LOCK
* <LI>SyncProvider.DATASOURCE_ROW_LOCK
* <LI>SyncProvider.DATASOURCE_TABLE_LOCK
* <LI>SyncProvider.DATASOURCE_DB_LOCK
* </UL>
* <LI>Constants to indicate whether a <code>SyncProvider</code> object can
* perform updates to an SQL <code>VIEW</code> <BR>
* These constants are explained in the preceding section (4.0).
* <UL>
* <LI>SyncProvider.UPDATABLE_VIEW_SYNC
* <LI>SyncProvider.NONUPDATABLE_VIEW_SYNC
* </UL>
* </OL>
*
* @author Jonathan Bruce
* @see javax.sql.rowset.spi.SyncFactory
* @see javax.sql.rowset.spi.SyncFactoryException
* @since 1.5
*/
public abstract class SyncProvider {
/**
* Creates a default <code>SyncProvider</code> object.
*/
public SyncProvider() {
}
/**
* Returns the unique identifier for this <code>SyncProvider</code> object.
*
* @return a <code>String</code> object with the fully qualified class name of
* this <code>SyncProvider</code> object
*/
public abstract String getProviderID();
/**
* Returns a <code>javax.sql.RowSetReader</code> object, which can be used to
* populate a <code>RowSet</code> object with data.
*
* @return a <code>javax.sql.RowSetReader</code> object
*/
public abstract RowSetReader getRowSetReader();
/**
* Returns a <code>javax.sql.RowSetWriter</code> object, which can be
* used to write a <code>RowSet</code> object's data back to the
* underlying data source.
*
* @return a <code>javax.sql.RowSetWriter</code> object
*/
public abstract RowSetWriter getRowSetWriter();
/**
* Returns a constant indicating the
* grade of synchronization a <code>RowSet</code> object can expect from
* this <code>SyncProvider</code> object.
*
* @return an int that is one of the following constants:
* SyncProvider.GRADE_NONE,
* SyncProvider.GRADE_CHECK_MODIFIED_AT_COMMIT,
* SyncProvider.GRADE_CHECK_ALL_AT_COMMIT,
* SyncProvider.GRADE_LOCK_WHEN_MODIFIED,
* SyncProvider.GRADE_LOCK_WHEN_LOADED
*/
public abstract int getProviderGrade();
/**
* Sets a lock on the underlying data source at the level indicated by
* <i>datasource_lock</i>. This should cause the
* <code>SyncProvider</code> to adjust its behavior by increasing or
* decreasing the level of optimism it provides for a successful
* synchronization.
*
* @param datasource_lock one of the following constants indicating the severity
* level of data source lock required:
* <pre>
* SyncProvider.DATASOURCE_NO_LOCK,
* SyncProvider.DATASOURCE_ROW_LOCK,
* SyncProvider.DATASOURCE_TABLE_LOCK,
* SyncProvider.DATASOURCE_DB_LOCK,
* </pre>
* @throws SyncProviderException if an unsupported data source locking level
* is set.
* @see #getDataSourceLock
*/
public abstract void setDataSourceLock(int datasource_lock)
throws SyncProviderException;
/**
* Returns the current data source lock severity level active in this
* <code>SyncProvider</code> implementation.
*
* @return a constant indicating the current level of data source lock
* active in this <code>SyncProvider</code> object;
* one of the following:
* <pre>
* SyncProvider.DATASOURCE_NO_LOCK,
* SyncProvider.DATASOURCE_ROW_LOCK,
* SyncProvider.DATASOURCE_TABLE_LOCK,
* SyncProvider.DATASOURCE_DB_LOCK
* </pre>
* @throws SyncProviderException if an error occurs determining the data
* source locking level.
* @see #setDataSourceLock
*/
public abstract int getDataSourceLock()
throws SyncProviderException;
/**
* Returns whether this <code>SyncProvider</code> implementation
* can perform synchronization between a <code>RowSet</code> object
* and the SQL <code>VIEW</code> in the data source from which
* the <code>RowSet</code> object got its data.
*
* @return an <code>int</code> saying whether this <code>SyncProvider</code>
* object supports updating an SQL <code>VIEW</code>; one of the
* following:
* SyncProvider.UPDATABLE_VIEW_SYNC,
* SyncProvider.NONUPDATABLE_VIEW_SYNC
*/
public abstract int supportsUpdatableView();
/**
* Returns the release version of this <code>SyncProvider</code> instance.
*
* @return a <code>String</code> detailing the release version of the
* <code>SyncProvider</code> implementation
*/
public abstract String getVersion();
/**
* Returns the vendor name of this <code>SyncProvider</code> instance
*
* @return a <code>String</code> detailing the vendor name of this
* <code>SyncProvider</code> implementation
*/
public abstract String getVendor();
/*
* Standard description of synchronization grades that a SyncProvider
* could provide.
*/
/**
* Indicates that no synchronization with the originating data source is
* provided. A <code>SyncProvider</code>
* implementation returning this grade will simply attempt to write
* updates in the <code>RowSet</code> object to the underlying data
* source without checking the validity of any data.
*
*/
public static final int GRADE_NONE = 1;
/**
* Indicates a low level optimistic synchronization grade with
* respect to the originating data source.
*
* A <code>SyncProvider</code> implementation
* returning this grade will check only rows that have changed.
*
*/
public static final int GRADE_CHECK_MODIFIED_AT_COMMIT = 2;
/**
* Indicates a high level optimistic synchronization grade with
* respect to the originating data source.
*
* A <code>SyncProvider</code> implementation
* returning this grade will check all rows, including rows that have not
* changed.
*/
public static final int GRADE_CHECK_ALL_AT_COMMIT = 3;
/**
* Indicates a pessimistic synchronization grade with
* respect to the originating data source.
*
* A <code>SyncProvider</code>
* implementation returning this grade will lock the row in the originating
* data source.
*/
public static final int GRADE_LOCK_WHEN_MODIFIED = 4;
/**
* Indicates the most pessimistic synchronization grade with
* respect to the originating
* data source. A <code>SyncProvider</code>
* implementation returning this grade will lock the entire view and/or
* table affected by the original statement used to populate a
* <code>RowSet</code> object.
*/
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 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 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 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 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 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 final int NONUPDATABLE_VIEW_SYNC = 6;
}

View file

@ -0,0 +1,165 @@
/*
* Copyright (c) 2003, 2006, 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.spi;
import java.sql.SQLException;
import javax.sql.rowset.*;
/**
* Indicates an error with the <code>SyncProvider</code> mechanism. This exception
* is created by a <code>SyncProvider</code> abstract class extension if it
* encounters violations in reading from or writing to the originating data source.
* <P>
* If it is implemented to do so, the <code>SyncProvider</code> object may also create a
* <code>SyncResolver</code> object and either initialize the <code>SyncProviderException</code>
* object with it at construction time or set it with the <code>SyncProvider</code> object at
* a later time.
* <P>
* The method <code>acceptChanges</code> will throw this exception after the writer
* has finished checking for conflicts and has found one or more conflicts. An
* application may catch a <code>SyncProviderException</code> object and call its
* <code>getSyncResolver</code> method to get its <code>SyncResolver</code> object.
* See the code fragment in the interface comment for
* <a href="SyncResolver.html"><code>SyncResolver</code></a> for an example.
* This <code>SyncResolver</code> object will mirror the <code>RowSet</code>
* object that generated the exception, except that it will contain only the values
* from the data source that are in conflict. All other values in the <code>SyncResolver</code>
* object will be <code>null</code>.
* <P>
* The <code>SyncResolver</code> object may be used to examine and resolve
* each conflict in a row and then go to the next row with a conflict to
* repeat the procedure.
* <P>
* A <code>SyncProviderException</code> object may or may not contain a description of the
* condition causing the exception. The inherited method <code>getMessage</code> may be
* called to retrieve the description if there is one.
*
* @author Jonathan Bruce
* @see javax.sql.rowset.spi.SyncFactory
* @see javax.sql.rowset.spi.SyncResolver
* @see javax.sql.rowset.spi.SyncFactoryException
* @since 1.5
*/
public class SyncProviderException extends java.sql.SQLException {
/**
* The instance of <code>javax.sql.rowset.spi.SyncResolver</code> that
* this <code>SyncProviderException</code> object will return when its
* <code>getSyncResolver</code> method is called.
*/
private SyncResolver syncResolver = null;
/**
* Creates a new <code>SyncProviderException</code> object without a detail message.
*/
public SyncProviderException() {
super();
}
/**
* Constructs a <code>SyncProviderException</code> object with the specified
* detail message.
*
* @param msg the detail message
*/
public SyncProviderException(String msg) {
super(msg);
}
/**
* Constructs a <code>SyncProviderException</code> object with the specified
* <code>SyncResolver</code> instance.
*
* @param syncResolver the <code>SyncResolver</code> instance used to
* to process the synchronization conflicts
* @throws IllegalArgumentException if the <code>SyncResolver</code> object
* is <code>null</code>.
*/
public SyncProviderException(SyncResolver syncResolver) {
if (syncResolver == null) {
throw new IllegalArgumentException("Cannot instantiate a SyncProviderException " +
"with a null SyncResolver object");
} else {
this.syncResolver = syncResolver;
}
}
/**
* Retrieves the <code>SyncResolver</code> object that has been set for
* this <code>SyncProviderException</code> object, or
* if none has been set, an instance of the default <code>SyncResolver</code>
* implementation included in the reference implementation.
* <P>
* If a <code>SyncProviderException</code> object is thrown, an application
* may use this method to generate a <code>SyncResolver</code> object
* with which to resolve the conflict or conflicts that caused the
* exception to be thrown.
*
* @return the <code>SyncResolver</code> object set for this
* <code>SyncProviderException</code> object or, if none has
* been set, an instance of the default <code>SyncResolver</code>
* implementation. In addition, the default <code>SyncResolver</code>
* implementation is also returned if the <code>SyncResolver()</code> or
* <code>SyncResolver(String)</code> constructors are used to instantiate
* the <code>SyncResolver</code> instance.
*/
public SyncResolver getSyncResolver() {
if (syncResolver != null) {
return syncResolver;
} else {
try {
syncResolver = new com.sun.rowset.internal.SyncResolverImpl();
} catch (SQLException sqle) {
}
return syncResolver;
}
}
/**
* Sets the <code>SyncResolver</code> object for this
* <code>SyncProviderException</code> object to the one supplied.
* If the argument supplied is <code>null</code>, a call to the method
* <code>getSyncResolver</code> will return the default reference
* implementation of the <code>SyncResolver</code> interface.
*
* @param syncResolver the <code>SyncResolver</code> object to be set;
* cannot be <code>null</code>
* @throws IllegalArgumentException if the <code>SyncResolver</code> object
* is <code>null</code>.
* @see #getSyncResolver
*/
public void setSyncResolver(SyncResolver syncResolver) {
if (syncResolver == null) {
throw new IllegalArgumentException("Cannot set a null SyncResolver " +
"object");
} else {
this.syncResolver = syncResolver;
}
}
static final long serialVersionUID = -939908523620640692L;
}

View file

@ -0,0 +1,377 @@
/*
* Copyright (c) 2003, 2013, 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.spi;
import javax.sql.RowSet;
import java.sql.SQLException;
/**
* Defines a framework that allows applications to use a manual decision tree
* to decide what should be done when a synchronization conflict occurs.
* Although it is not mandatory for
* applications to resolve synchronization conflicts manually, this
* framework provides the means to delegate to the application when conflicts
* arise.
* <p>
* Note that a conflict is a situation where the <code>RowSet</code> object's original
* values for a row do not match the values in the data source, which indicates that
* the data source row has been modified since the last synchronization. Note also that
* a <code>RowSet</code> object's original values are the values it had just prior to the
* the last synchronization, which are not necessarily its initial values.
*
*
* <H2>Description of a <code>SyncResolver</code> Object</H2>
*
* A <code>SyncResolver</code> object is a specialized <code>RowSet</code> object
* that implements the <code>SyncResolver</code> interface.
* It <b>may</b> operate as either a connected <code>RowSet</code> object (an
* implementation of the <code>JdbcRowSet</code> interface) or a connected
* <code>RowSet</code> object (an implementation of the
* <code>CachedRowSet</code> interface or one of its subinterfaces). For information
* on the subinterfaces, see the
* <a href="../package-summary.html"><code>javax.sql.rowset</code></a> package
* description. The reference implementation for <code>SyncResolver</code> implements
* the <code>CachedRowSet</code> interface, but other implementations
* may choose to implement the <code>JdbcRowSet</code> interface to satisfy
* particular needs.
* <P>
* After an application has attempted to synchronize a <code>RowSet</code> object with
* the data source (by calling the <code>CachedRowSet</code>
* method <code>acceptChanges</code>), and one or more conflicts have been found,
* a rowset's <code>SyncProvider</code> object creates an instance of
* <code>SyncResolver</code>. This new <code>SyncResolver</code> object has
* the same number of rows and columns as the
* <code>RowSet</code> object that was attempting the synchronization. The
* <code>SyncResolver</code> object contains the values from the data source that caused
* the conflict(s) and <code>null</code> for all other values.
* In addition, it contains information about each conflict.
*
*
* <H2>Getting and Using a <code>SyncResolver</code> Object</H2>
*
* When the method <code>acceptChanges</code> encounters conflicts, the
* <code>SyncProvider</code> object creates a <code>SyncProviderException</code>
* object and sets it with the new <code>SyncResolver</code> object. The method
* <code>acceptChanges</code> will throw this exception, which
* the application can then catch and use to retrieve the
* <code>SyncResolver</code> object it contains. The following code snippet uses the
* <code>SyncProviderException</code> method <code>getSyncResolver</code> to get
* the <code>SyncResolver</code> object <i>resolver</i>.
* <PRE>
* {@code
* } catch (SyncProviderException spe) {
* SyncResolver resolver = spe.getSyncResolver();
* ...
* }
*
* }
* </PRE>
* <P>
* With <i>resolver</i> in hand, an application can use it to get the information
* it contains about the conflict or conflicts. A <code>SyncResolver</code> object
* such as <i>resolver</i> keeps
* track of the conflicts for each row in which there is a conflict. It also places a
* lock on the table or tables affected by the rowset's command so that no more
* conflicts can occur while the current conflicts are being resolved.
* <P>
* The following kinds of information can be obtained from a <code>SyncResolver</code>
* object:
*
* <h3>What operation was being attempted when a conflict occurred</h3>
* The <code>SyncProvider</code> interface defines four constants
* describing states that may occur. Three
* constants describe the type of operation (update, delete, or insert) that a
* <code>RowSet</code> object was attempting to perform when a conflict was discovered,
* and the fourth indicates that there is no conflict.
* These constants are the possible return values when a <code>SyncResolver</code> object
* calls the method <code>getStatus</code>.
* <PRE>
* {@code int operation = resolver.getStatus(); }
* </PRE>
*
* <h3>The value in the data source that caused a conflict</h3>
* A conflict exists when a value that a <code>RowSet</code> object has changed
* and is attempting to write to the data source
* has also been changed in the data source since the last synchronization. An
* application can call the <code>SyncResolver</code> method
* <code>getConflictValue</code > to retrieve the
* value in the data source that is the cause of the conflict because the values in a
* <code>SyncResolver</code> object are the conflict values from the data source.
* <PRE>
* java.lang.Object conflictValue = resolver.getConflictValue(2);
* </PRE>
* Note that the column in <i>resolver</i> can be designated by the column number,
* as is done in the preceding line of code, or by the column name.
* <P>
* With the information retrieved from the methods <code>getStatus</code> and
* <code>getConflictValue</code>, the application may make a determination as to
* which value should be persisted in the data source. The application then calls the
* <code>SyncResolver</code> method <code>setResolvedValue</code>, which sets the value
* to be persisted in the <code>RowSet</code> object and also in the data source.
* <PRE>
* resolver.setResolvedValue("DEPT", 8390426);
* </PRE>
* In the preceding line of code,
* the column name designates the column in the <code>RowSet</code> object
* that is to be set with the given value. The column number can also be used to
* designate the column.
* <P>
* An application calls the method <code>setResolvedValue</code> after it has
* resolved all of the conflicts in the current conflict row and repeats this process
* for each conflict row in the <code>SyncResolver</code> object.
*
*
* <H2>Navigating a <code>SyncResolver</code> Object</H2>
*
* Because a <code>SyncResolver</code> object is a <code>RowSet</code> object, an
* application can use all of the <code>RowSet</code> methods for moving the cursor
* to navigate a <code>SyncResolver</code> object. For example, an application can
* use the <code>RowSet</code> method <code>next</code> to get to each row and then
* call the <code>SyncResolver</code> method <code>getStatus</code> to see if the row
* contains a conflict. In a row with one or more conflicts, the application can
* iterate through the columns to find any non-null values, which will be the values
* from the data source that are in conflict.
* <P>
* To make it easier to navigate a <code>SyncResolver</code> object, especially when
* there are large numbers of rows with no conflicts, the <code>SyncResolver</code>
* interface defines the methods <code>nextConflict</code> and
* <code>previousConflict</code>, which move only to rows
* that contain at least one conflict value. Then an application can call the
* <code>SyncResolver</code> method <code>getConflictValue</code>, supplying it
* with the column number, to get the conflict value itself. The code fragment in the
* next section gives an example.
*
* <H2>Code Example</H2>
*
* The following code fragment demonstrates how a disconnected <code>RowSet</code>
* object <i>crs</i> might attempt to synchronize itself with the
* underlying data source and then resolve the conflicts. In the <code>try</code>
* block, <i>crs</i> calls the method <code>acceptChanges</code>, passing it the
* <code>Connection</code> object <i>con</i>. If there are no conflicts, the
* changes in <i>crs</i> are simply written to the data source. However, if there
* is a conflict, the method <code>acceptChanges</code> throws a
* <code>SyncProviderException</code> object, and the
* <code>catch</code> block takes effect. In this example, which
* illustrates one of the many ways a <code>SyncResolver</code> object can be used,
* the <code>SyncResolver</code> method <code>nextConflict</code> is used in a
* <code>while</code> loop. The loop will end when <code>nextConflict</code> returns
* <code>false</code>, which will occur when there are no more conflict rows in the
* <code>SyncResolver</code> object <i>resolver</i>. In This particular code fragment,
* <i>resolver</i> looks for rows that have update conflicts (rows with the status
* <code>SyncResolver.UPDATE_ROW_CONFLICT</code>), and the rest of this code fragment
* executes only for rows where conflicts occurred because <i>crs</i> was attempting an
* update.
* <P>
* After the cursor for <i>resolver</i> has moved to the next conflict row that
* has an update conflict, the method <code>getRow</code> indicates the number of the
* current row, and
* the cursor for the <code>CachedRowSet</code> object <i>crs</i> is moved to
* the comparable row in <i>crs</i>. By iterating
* through the columns of that row in both <i>resolver</i> and <i>crs</i>, the conflicting
* values can be retrieved and compared to decide which one should be persisted. In this
* code fragment, the value in <i>crs</i> is the one set as the resolved value, which means
* that it will be used to overwrite the conflict value in the data source.
*
* <PRE>
* {@code
* try {
*
* crs.acceptChanges(con);
*
* } catch (SyncProviderException spe) {
*
* SyncResolver resolver = spe.getSyncResolver();
*
* Object crsValue; // value in the RowSet object
* Object resolverValue: // value in the SyncResolver object
* Object resolvedValue: // value to be persisted
*
* while(resolver.nextConflict()) {
* if(resolver.getStatus() == SyncResolver.UPDATE_ROW_CONFLICT) {
* int row = resolver.getRow();
* crs.absolute(row);
*
* int colCount = crs.getMetaData().getColumnCount();
* for(int j = 1; j <= colCount; j++) {
* if (resolver.getConflictValue(j) != null) {
* crsValue = crs.getObject(j);
* resolverValue = resolver.getConflictValue(j);
* . . .
* // compare crsValue and resolverValue to determine
* // which should be the resolved value (the value to persist)
* resolvedValue = crsValue;
*
* resolver.setResolvedValue(j, resolvedValue);
* }
* }
* }
* }
* }
* }</PRE>
*
* @author Jonathan Bruce
* @since 1.5
*/
public interface SyncResolver extends RowSet {
/**
* Indicates that a conflict occurred while the <code>RowSet</code> object was
* attempting to update a row in the data source.
* The values in the data source row to be updated differ from the
* <code>RowSet</code> object's original values for that row, which means that
* the row in the data source has been updated or deleted since the last
* synchronization.
*/
public static int UPDATE_ROW_CONFLICT = 0;
/**
* Indicates that a conflict occurred while the <code>RowSet</code> object was
* attempting to delete a row in the data source.
* The values in the data source row to be updated differ from the
* <code>RowSet</code> object's original values for that row, which means that
* the row in the data source has been updated or deleted since the last
* synchronization.
*/
public static int DELETE_ROW_CONFLICT = 1;
/**
* Indicates that a conflict occurred while the <code>RowSet</code> object was
* attempting to insert a row into the data source. This means that a
* row with the same primary key as the row to be inserted has been inserted
* into the data source since the last synchronization.
*/
public static int INSERT_ROW_CONFLICT = 2;
/**
* Indicates that <b>no</b> conflict occurred while the <code>RowSet</code> object
* was attempting to update, delete or insert a row in the data source. The values in
* the <code>SyncResolver</code> will contain <code>null</code> values only as an indication
* that no information in pertinent to the conflict resolution in this row.
*/
public static int NO_ROW_CONFLICT = 3;
/**
* Retrieves the conflict status of the current row of this <code>SyncResolver</code>,
* which indicates the operation
* the <code>RowSet</code> object was attempting when the conflict occurred.
*
* @return one of the following constants:
* <code>SyncResolver.UPDATE_ROW_CONFLICT</code>,
* <code>SyncResolver.DELETE_ROW_CONFLICT</code>,
* <code>SyncResolver.INSERT_ROW_CONFLICT</code>, or
* <code>SyncResolver.NO_ROW_CONFLICT</code>
*/
public int getStatus();
/**
* Retrieves the value in the designated column in the current row of this
* <code>SyncResolver</code> object, which is the value in the data source
* that caused a conflict.
*
* @param index an <code>int</code> designating the column in this row of this
* <code>SyncResolver</code> object from which to retrieve the value
* causing a conflict
* @return the value of the designated column in the current row of this
* <code>SyncResolver</code> object
* @throws SQLException if a database access error occurs
*/
public Object getConflictValue(int index) throws SQLException;
/**
* Retrieves the value in the designated column in the current row of this
* <code>SyncResolver</code> object, which is the value in the data source
* that caused a conflict.
*
* @param columnName a <code>String</code> object designating the column in this row of this
* <code>SyncResolver</code> object from which to retrieve the value
* causing a conflict
* @return the value of the designated column in the current row of this
* <code>SyncResolver</code> object
* @throws SQLException if a database access error occurs
*/
public Object getConflictValue(String columnName) throws SQLException;
/**
* Sets <i>obj</i> as the value in column <i>index</i> in the current row of the
* <code>RowSet</code> object that is being synchronized. <i>obj</i>
* is set as the value in the data source internally.
*
* @param index an <code>int</code> giving the number of the column into which to
* set the value to be persisted
* @param obj an <code>Object</code> that is the value to be set in the
* <code>RowSet</code> object and persisted in the data source
* @throws SQLException if a database access error occurs
*/
public void setResolvedValue(int index, Object obj) throws SQLException;
/**
* Sets <i>obj</i> as the value in column <i>columnName</i> in the current row of the
* <code>RowSet</code> object that is being synchronized. <i>obj</i>
* is set as the value in the data source internally.
*
* @param columnName a <code>String</code> object giving the name of the column
* into which to set the value to be persisted
* @param obj an <code>Object</code> that is the value to be set in the
* <code>RowSet</code> object and persisted in the data source
* @throws SQLException if a database access error occurs
*/
public void setResolvedValue(String columnName, Object obj) throws SQLException;
/**
* Moves the cursor down from its current position to the next row that contains
* a conflict value. A <code>SyncResolver</code> object's
* cursor is initially positioned before the first conflict row; the first call to the
* method <code>nextConflict</code> makes the first conflict row the current row;
* the second call makes the second conflict row the current row, and so on.
* <p>
* A call to the method <code>nextConflict</code> will implicitly close
* an input stream if one is open and will clear the <code>SyncResolver</code>
* object's warning chain.
*
* @return <code>true</code> if the new current row is valid; <code>false</code>
* if there are no more rows
* @throws SQLException if a database access error occurs or the result set type
* is <code>TYPE_FORWARD_ONLY</code>
*
*/
public boolean nextConflict() throws SQLException;
/**
* Moves the cursor up from its current position to the previous conflict
* row in this <code>SyncResolver</code> object.
* <p>
* A call to the method <code>previousConflict</code> will implicitly close
* an input stream if one is open and will clear the <code>SyncResolver</code>
* object's warning chain.
*
* @return <code>true</code> if the cursor is on a valid row; <code>false</code>
* if it is off the result set
* @throws SQLException if a database access error occurs or the result set type
* is <code>TYPE_FORWARD_ONLY</code>
*/
public boolean previousConflict() throws SQLException;
}

View file

@ -0,0 +1,85 @@
/*
* Copyright (c) 2003, 2013, 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.spi;
import java.sql.SQLException;
import java.io.Reader;
import javax.sql.RowSetWriter;
import javax.sql.rowset.*;
import java.sql.Savepoint;
/**
* A specialized interface that facilitates an extension of the standard
* <code>SyncProvider</code> abstract class so that it has finer grained
* transaction control.
* <p>
* If one or more disconnected <code>RowSet</code> objects are participating
* in a global transaction, they may wish to coordinate their synchronization
* commits to preserve data integrity and reduce the number of
* synchronization exceptions. If this is the case, an application should set
* the <code>CachedRowSet</code> constant <code>COMMIT_ON_ACCEPT_CHANGES</code>
* to <code>false</code> and use the <code>commit</code> and <code>rollback</code>
* methods defined in this interface to manage transaction boundaries.
*
* @since 1.5
*/
public interface TransactionalWriter extends RowSetWriter {
/**
* Makes permanent all changes that have been performed by the
* <code>acceptChanges</code> method since the last call to either the
* <code>commit</code> or <code>rollback</code> methods.
* This method should be used only when auto-commit mode has been disabled.
*
* @throws SQLException if a database access error occurs or the
* <code>Connection</code> object within this <code>CachedRowSet</code>
* object is in auto-commit mode
*/
public void commit() throws SQLException;
/**
* Undoes all changes made in the current transaction. This method should be
* used only when auto-commit mode has been disabled.
*
* @throws SQLException if a database access error occurs or the <code>Connection</code>
* object within this <code>CachedRowSet</code> object is in auto-commit mode
*/
public void rollback() throws SQLException;
/**
* Undoes all changes made in the current transaction made prior to the given
* <code>Savepoint</code> object. This method should be used only when auto-commit
* mode has been disabled.
*
* @param s a <code>Savepoint</code> object marking a savepoint in the current
* transaction. All changes made before <i>s</i> was set will be undone.
* All changes made after <i>s</i> was set will be made permanent.
* @throws SQLException if a database access error occurs or the <code>Connection</code>
* object within this <code>CachedRowSet</code> object is in auto-commit mode
*/
public void rollback(Savepoint s) throws SQLException;
}

View file

@ -0,0 +1,76 @@
/*
* Copyright (c) 2003, 2013, 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.spi;
import java.sql.SQLException;
import java.io.Reader;
import javax.sql.RowSetReader;
import javax.sql.rowset.*;
/**
* A specialized interface that facilitates an extension of the
* <code>SyncProvider</code> abstract class for XML orientated
* synchronization providers.
* <P>
* <code>SyncProvider</code> implementations that supply XML data reader
* capabilities such as output XML stream capabilities can implement this
* interface to provide standard <code>XmlReader</code> objects to
* <code>WebRowSet</code> implementations.
* <p>
* An <code>XmlReader</code> object is registered as the
* XML reader for a <code>WebRowSet</code> by being assigned to the
* rowset's <code>xmlReader</code> field. When the <code>WebRowSet</code>
* object's <code>readXml</code> method is invoked, it in turn invokes
* its XML reader's <code>readXML</code> method.
*
* @since 1.5
*/
public interface XmlReader extends RowSetReader {
/**
* Reads and parses the given <code>WebRowSet</code> object from the given
* input stream in XML format. The <code>xmlReader</code> field of the
* given <code>WebRowSet</code> object must contain this
* <code>XmlReader</code> object.
* <P>
* If a parsing error occurs, the exception that is thrown will
* include information about the location of the error in the
* original XML document.
*
* @param caller the <code>WebRowSet</code> object to be parsed, whose
* <code>xmlReader</code> field must contain a reference to
* this <code>XmlReader</code> object
* @param reader the <code>java.io.Reader</code> object from which
* <code>caller</code> will be read
* @throws SQLException if a database access error occurs or
* this <code>XmlReader</code> object is not the reader
* for the given rowset
*/
public void readXML(WebRowSet caller, java.io.Reader reader)
throws SQLException;
}

View file

@ -0,0 +1,76 @@
/*
* Copyright (c) 2003, 2013, 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.spi;
import java.sql.SQLException;
import java.io.Writer;
import javax.sql.RowSetWriter;
import javax.sql.rowset.*;
/**
* A specialized interface that facilitates an extension of the
* <code>SyncProvider</code> abstract class for XML orientated
* synchronization providers.
* <p>
* <code>SyncProvider</code> implementations that supply XML data writer
* capabilities such as output XML stream capabilities can implement this
* interface to provide standard <code>XmlWriter</code> objects to
* <code>WebRowSet</code> implementations.
* <P>
* Writing a <code>WebRowSet</code> object includes printing the
* rowset's data, metadata, and properties, all with the
* appropriate XML tags.
*
* @since 1.5
*/
public interface XmlWriter extends RowSetWriter {
/**
* Writes the given <code>WebRowSet</code> object to the specified
* <code>java.io.Writer</code> output stream as an XML document.
* This document includes the rowset's data, metadata, and properties
* plus the appropriate XML tags.
* <P>
* The <code>caller</code> parameter must be a <code>WebRowSet</code>
* object whose <code>XmlWriter</code> field contains a reference to
* this <code>XmlWriter</code> object.
*
* @param caller the <code>WebRowSet</code> instance to be written,
* for which this <code>XmlWriter</code> object is the writer
* @param writer the <code>java.io.Writer</code> object that serves
* as the output stream for writing <code>caller</code> as
* an XML document
* @throws SQLException if a database access error occurs or
* this <code>XmlWriter</code> object is not the writer
* for the given <code>WebRowSet</code> object
*/
public void writeXML(WebRowSet caller, java.io.Writer writer)
throws SQLException;
}

View file

@ -0,0 +1,493 @@
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR"
content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]">
<!--
Copyright (c) 2003, 2017, 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.
-->
<title>javax.sql.rowset.spi</title>
</head>
<body>
The standard classes and interfaces that a third party vendor has to
use in its implementation of a synchronization provider. These classes and
interfaces are referred to as the Service Provider Interface (SPI). To make it possible
for a <code>RowSet</code> object to use an implementation, the vendor must register
it with the <code>SyncFactory</code> singleton. (See the class comment for
<code>SyncProvider</code> for a full explanation of the registration process and
the naming convention to be used.)
<h2>Table of Contents</h2>
<ul>
<li><a href="#pkgspec">1.0 Package Specification</a>
<li><a href="#arch">2.0 Service Provider Architecture</a>
<li><a href="#impl">3.0 Implementer's Guide</a>
<li><a href="#resolving">4.0 Resolving Synchronization Conflicts</a>
<li><a href="#relspec">5.0 Related Specifications</a>
<li><a href="#reldocs">6.0 Related Documentation</a>
</ul>
<h3><a id="pkgspec">1.0 Package Specification</a></h3>
<P>
The following classes and interfaces make up the <code>javax.sql.rowset.spi</code>
package:
<UL>
<LI><code>SyncFactory</code>
<LI><code>SyncProvider</code>
<LI><code>SyncFactoryException</code>
<LI><code>SyncProviderException</code>
<LI><code>SyncResolver</code>
<LI><code>XmlReader</code>
<LI><code>XmlWriter</code>
<LI><code>TransactionalWriter</code>
</UL>
The following interfaces, in the <code>javax.sql</code> package, are also part of the SPI:
<UL>
<LI><code>RowSetReader</code>
<LI><code>RowSetWriter</code>
</UL>
<P>
A <code>SyncProvider</code> implementation provides a disconnected <code>RowSet</code>
object with the mechanisms for reading data into it and for writing data that has been
modified in it
back to the underlying data source. A <i>reader</i>, a <code>RowSetReader</code> or
<code>XMLReader</code> object, reads data into a <code>RowSet</code> object when the
<code>CachedRowSet</code> methods <code>execute</code> or <code>populate</code>
are called. A <i>writer</i>, a <code>RowSetWriter</code> or <code>XMLWriter</code>
object, writes changes back to the underlying data source when the
<code>CachedRowSet</code> method <code>acceptChanges</code> is called.
<P>
The process of writing changes in a <code>RowSet</code> object to its data source
is known as <i>synchronization</i>. The <code>SyncProvider</code> implementation that a
<code>RowSet</code> object is using determines the level of synchronization that the
<code>RowSet</code> object's writer uses. The various levels of synchronization are
referred to as <i>grades</i>.
<P>
The lower grades of synchronization are
known as <i>optimistic</i> concurrency levels because they optimistically
assume that there will be no conflicts or very few conflicts. A conflict exists when
the same data modified in the <code>RowSet</code> object has also been modified
in the data source. Using the optimistic concurrency model means that if there
is a conflict, modifications to either the data source or the <code>RowSet</code>
object will be lost.
<P>
Higher grades of synchronization are called <i>pessimistic</i> because they assume
that others will be accessing the data source and making modifications. These
grades set varying levels of locks to increase the chances that no conflicts
occur.
<P>
The lowest level of synchronization is simply writing any changes made to the
<code>RowSet</code> object to its underlying data source. The writer does
nothing to check for conflicts.
If there is a conflict and the data
source values are overwritten, the changes other parties have made by to the data
source are lost.
<P>
The <code>RIXMLProvider</code> implementation uses the lowest level
of synchronization and just writes <code>RowSet</code> changes to the data source.
<P>
For the next level up, the
writer checks to see if there are any conflicts, and if there are,
it does not write anything to the data source. The problem with this concurrency
level is that if another party has modified the corresponding data in the data source
since the <code>RowSet</code> object got its data,
the changes made to the <code>RowSet</code> object are lost. The
<code>RIOptimisticProvider</code> implementation uses this level of synchronization.
<P>
At higher levels of synchronization, referred to as pessimistic concurrency,
the writer take steps to avoid conflicts by setting locks. Setting locks
can vary from setting a lock on a single row to setting a lock on a table
or the entire data source. The level of synchronization is therefore a tradeoff
between the ability of users to access the data source concurrently and the ability
of the writer to keep the data in the <code>RowSet</code> object and its data source
synchronized.
<P>
It is a requirement that all disconnected <code>RowSet</code> objects
(<code>CachedRowSet</code>, <code>FilteredRowSet</code>, <code>JoinRowSet</code>,
and <code>WebRowSet</code> objects) obtain their <code>SyncProvider</code> objects
from the <code>SyncFactory</code> mechanism.
<P>
The reference implementation (RI) provides two synchronization providers.
<UL>
<LI><b><code>RIOptimisticProvider</code></b> <br>
The default provider that the <code>SyncFactory</code> instance will
supply to a disconnected <code>RowSet</code> object when no provider
implementation is specified.<BR>
This synchronization provider uses an optimistic concurrency model,
assuming that there will be few conflicts among users
who are accessing the same data in a database. It avoids
using locks; rather, it checks to see if there is a conflict
before trying to synchronize the <code>RowSet</code> object and the
data source. If there is a conflict, it does nothing, meaning that
changes to the <code>RowSet</code> object are not persisted to the data
source.
<LI><B><code>RIXMLProvider</code></B> <BR>
A synchronization provider that can be used with a
<code>WebRowSet</code> object, which is a rowset that can be written
in XML format or read from XML format. The
<code>RIXMLProvider</code> implementation does no checking at all for
conflicts and simply writes any updated data in the
<code>WebRowSet</code> object to the underlying data source.
<code>WebRowSet</code> objects use this provider when they are
dealing with XML data.
</UL>
These <code>SyncProvider</code> implementations
are bundled with the reference implementation, which makes them always available to
<code>RowSet</code> implementations.
<code>SyncProvider</code> implementations make themselves available by being
registered with the <code>SyncFactory</code> singleton. When a <code>RowSet</code>
object requests a provider, by specifying it in the constructor or as an argument to the
<code>CachedRowSet</code> method <code>setSyncProvider</code>,
the <code>SyncFactory</code> singleton
checks to see if the requested provider has been registered with it.
If it has, the <code>SyncFactory</code> creates an instance of it and passes it to the
requesting <code>RowSet</code> object.
If the <code>SyncProvider</code> implementation that is specified has not been registered,
the <code>SyncFactory</code> singleton causes a <code>SyncFactoryException</code> object
to be thrown. If no provider is specified,
the <code>SyncFactory</code> singleton will create an instance of the default
provider implementation, <code>RIOptimisticProvider</code>,
and pass it to the requesting <code>RowSet</code> object.
<P>
If a <code>WebRowSet</code> object does not specify a provider in its constructor, the
<code>SyncFactory</code> will give it an instance of <code>RIOptimisticProvider</code>.
However, the constructor for <code>WebRowSet</code> is implemented to set the provider
to the <code>RIXMLProvider</code>, which reads and writes a <code>RowSet</code> object
in XML format.
<P>
See the <a href="SyncProvider.html">SyncProvider</a> class
specification for further details.
<p>
Vendors may develop a <code>SyncProvider</code> implementation with any one of the possible
levels of synchronization, thus giving <code>RowSet</code> objects a choice of
synchronization mechanisms.
<h3><a id="arch">2.0 Service Provider Interface Architecture</a></h3>
<b>2.1 Overview</b>
<p>
The Service Provider Interface provides a pluggable mechanism by which
<code>SyncProvider</code> implementations can be registered and then generated when
required. The lazy reference mechanism employed by the <code>SyncFactory</code> limits
unnecessary resource consumption by not creating an instance until it is
required by a disconnected
<code>RowSet</code> object. The <code>SyncFactory</code> class also provides
a standard API to configure logging options and streams that <b>may</b> be provided
by a particular <code>SyncProvider</code> implementation.
<p>
<b>2.2 Registering with the <code>SyncFactory</code></b>
<p>
A third party <code>SyncProvider</code> implementation must be registered with the
<code>SyncFactory</code> in order for a disconnected <code>RowSet</code> object
to obtain it and thereby use its <code>javax.sql.RowSetReader</code> and
<code>javax.sql.RowSetWriter</code>
implementations. The following registration mechanisms are available to all
<code>SyncProvider</code> implementations:
<ul>
<li><b>System properties</b> - Properties set at the command line. These
properties are set at run time and apply system-wide per invocation of the Java
application. See the section <a href="#reldocs">"Related Documentation"</a>
further related information.
<li><b>Property Files</b> - Properties specified in a standard property file.
This can be specified using a System Property or by modifying a standard
property file located in the platform run-time. The
reference implementation of this technology includes a standard property
file than can be edited to add additional <code>SyncProvider</code> objects.
<li><b>JNDI Context</b> - Available providers can be registered on a JNDI
context. The <code>SyncFactory</code> will attempt to load <code>SyncProvider</code>
objects bound to the context and register them with the factory. This
context must be supplied to the <code>SyncFactory</code> for the mechanism to
function correctly.
</ul>
<p>
Details on how to specify the system properties or properties in a property file
and how to configure the JNDI Context are explained in detail in the
<a href="SyncFactory.html"><code>SyncFactory</code></a> class description.
<p>
<b>2.3 SyncFactory Provider Instance Generation Policies</b>
<p>
The <code>SyncFactory</code> generates a requested <code>SyncProvider</code>
object if the provider has been correctly registered. The
following policies are adhered to when either a disconnected <code>RowSet</code> object
is instantiated with a specified <code>SyncProvider</code> implementation or is
reconfigured at runtime with an alternative <code>SyncProvider</code> object.
<ul>
<li> If a <code>SyncProvider</code> object is specified and the <code>SyncFactory</code>
contains <i>no</i> reference to the provider, a <code>SyncFactoryException</code> is
thrown.
<li> If a <code>SyncProvider</code> object is specified and the <code>SyncFactory</code>
contains a reference to the provider, the requested provider is supplied.
<li> If no <code>SyncProvider</code> object is specified, the reference
implementation provider <code>RIOptimisticProvider</code> is supplied.
</ul>
<p>
These policies are explored in more detail in the <a href="SyncFactory.html">
<code>SyncFactory</code></a> class.
<h3><a id="impl">3.0 SyncProvider Implementer's Guide</a></h3>
<b>3.1 Requirements</b>
<p>
A compliant <code>SyncProvider</code> implementation that is fully pluggable
into the <code>SyncFactory</code> <b>must</b> extend and implement all
abstract methods in the <a href="SyncProvider.html"><code>SyncProvider</code></a>
class. In addition, an implementation <b>must</b> determine the
grade, locking and updatable view capabilities defined in the
<code>SyncProvider</code> class definition. One or more of the
<code>SyncProvider</code> description criteria <b>must</b> be supported. It
is expected that vendor implementations will offer a range of grade, locking, and
updatable view capabilities.
<p>
Furthermore, the <code>SyncProvider</code> naming convention <b>must</b> be followed as
detailed in the <a href="SyncProvider.html"><code>SyncProvider</code></a> class
description.
<p>
<b>3.2 Grades</b>
<p>
JSR 114 defines a set of grades to describe the quality of synchronization
a <code>SyncProvider</code> object can offer a disconnected <code>RowSet</code>
object. These grades are listed from the lowest quality of service to the highest.
<ul>
<li><b>GRADE_NONE</b> - No synchronization with the originating data source is
provided. A <code>SyncProvider</code> implementation returning this grade will simply
attempt to write any data that has changed in the <code>RowSet</code> object to the
underlying data source, overwriting whatever is there. No attempt is made to compare
original values with current values to see if there is a conflict. The
<code>RIXMLProvider</code> is implemented with this grade.
<li><b>GRADE_CHECK_MODIFIED_AT_COMMIT</b> - A low grade of optimistic synchronization.
A <code>SyncProvider</code> implementation returning this grade
will check for conflicts in rows that have changed between the last synchronization
and the current synchronization under way. Any changes in the originating data source
that have been modified will not be reflected in the disconnected <code>RowSet</code>
object. If there are no conflicts, changes in the <code>RowSet</code> object will be
written to the data source. If there are conflicts, no changes are written.
The <code>RIOptimisticProvider</code> implementation uses this grade.
<li><b>GRADE_CHECK_ALL_AT_COMMIT</b> - A high grade of optimistic synchronization.
A <code>SyncProvider</code> implementation returning this grade
will check all rows, including rows that have not changed in the disconnected
<code>RowSet</code> object. In this way, any changes to rows in the underlying
data source will be reflected in the disconnected <code>RowSet</code> object
when the synchronization finishes successfully.
<li><b>GRADE_LOCK_WHEN_MODIFIED</b> - A pessimistic grade of synchronization.
<code>SyncProvider</code> implementations returning this grade will lock
the row in the originating data source that corresponds to the row being changed
in the <code>RowSet</code> object to reduce the possibility of other
processes modifying the same data in the data source.
<li><b>GRADE_LOCK_WHEN_LOADED</b> - A higher pessimistic synchronization grade.
A <code>SyncProvider</code> implementation returning this grade will lock
the entire view and/or table affected by the original query used to
populate a <code>RowSet</code> object.
</ul>
<p>
<b>3.3 Locks</b>
<p>
JSR 114 defines a set of constants that specify whether any locks have been
placed on a <code>RowSet</code> object's underlying data source and, if so,
on which constructs the locks are placed. These locks will remain on the data
source while the <code>RowSet</code> object is disconnected from the data source.
<P>
These constants <b>should</b> be considered complementary to the
grade constants. The default setting for the majority of grade settings requires
that no data source locks remain when a <code>RowSet</code> object is disconnected
from its data source.
The grades <code>GRADE_LOCK_WHEN_MODIFIED</code> and
<code>GRADE_LOCK_WHEN_LOADED</code> allow a disconnected <code>RowSet</code> object
to have a fine-grained control over the degree of locking.
<ul>
<li><b>DATASOURCE_NO_LOCK</b> - 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.
<li><b>DATASOURCE_ROW_LOCK</b> - A lock is placed on the rows that are touched by
the original SQL query used to populate the <code>RowSet</code> object.
<li><b>DATASOURCE_TABLE_LOCK</b> - A lock is placed on all tables that are touched
by the query that was used to populate the <code>RowSet</code> object.
<li><b>DATASOURCE_DB_LOCK</b>
A lock is placed on the entire data source that is used by the <code>RowSet</code>
object.
</ul>
<p>
<b>3.4 Updatable Views</b>
<p>
A <code>RowSet</code> object may be populated with data from an SQL <code>VIEW</code>.
The following constants indicate whether a <code>SyncProvider</code> object can
update data in the table or tables from which the <code>VIEW</code> was derived.
<ul>
<li><b>UPDATABLE_VIEW_SYNC</b>
Indicates that a <code>SyncProvider</code> implementation supports synchronization
to the table or tables from which the SQL <code>VIEW</code> used to populate
a <code>RowSet</code> object is derived.
<li><b>NONUPDATABLE_VIEW_SYNC</b>
Indicates that a <code>SyncProvider</code> implementation does <b>not</b> support
synchronization to the table or tables from which the SQL <code>VIEW</code>
used to populate a <code>RowSet</code> object is derived.
</ul>
<p>
<b>3.5 Usage of <code>SyncProvider</code> Grading and Locking</b>
<p>
In the example below, the reference <code>CachedRowSetImpl</code> implementation
reconfigures its current <code>SyncProvider</code> object by calling the
<code>setSyncProvider</code> method.<br>
<PRE>
CachedRowSetImpl crs = new CachedRowSetImpl();
crs.setSyncProvider("com.foo.bar.HASyncProvider");
</PRE>
An application can retrieve the <code>SyncProvider</code> object currently in use
by a disconnected <code>RowSet</code> object. It can also retrieve the
grade of synchronization with which the provider was implemented and the degree of
locking currently in use. In addition, an application has the flexibility to set
the degree of locking to be used, which can increase the possibilities for successful
synchronization. These operation are shown in the following code fragment.
<PRE>
SyncProvider sync = crs.getSyncProvider();
switch (sync.getProviderGrade()) {
case: SyncProvider.GRADE_CHECK_ALL_AT_COMMIT
//A high grade of optimistic synchronization
break;
case: SyncProvider.GRADE_CHECK_MODIFIED_AT_COMMIT
//A low grade of optimistic synchronization
break;
case: SyncProvider.GRADE_LOCK_WHEN_LOADED
// A pessimistic synchronization grade
break;
case: SyncProvider.GRADE_LOCK_WHEN_MODIFIED
// A pessimistic synchronization grade
break;
case: SyncProvider.GRADE_NONE
// No synchronization with the originating data source provided
break;
}
switch (sync.getDataSourcLock() {
case: SyncProvider.DATASOURCE_DB_LOCK
// A lock is placed on the entire datasource that is used by the
// <code>RowSet</code> object
break;
case: SyncProvider.DATASOURCE_NO_LOCK
// No locks remain on the originating data source.
break;
case: SyncProvider.DATASOURCE_ROW_LOCK
// A lock is placed on the rows that are touched by the original
// SQL statement used to populate
// the RowSet object that is using the SyncProvider
break;
case: DATASOURCE_TABLE_LOCK
// A lock is placed on all tables that are touched by the original
// SQL statement used to populated
// the RowSet object that is using the SyncProvider
break;
</PRE>
It is also possible using the static utility method in the
<code>SyncFactory</code> class to determine the list of <code>SyncProvider</code>
implementations currently registered with the <code>SyncFactory</code>.
<pre>
Enumeration e = SyncFactory.getRegisteredProviders();
</pre>
<h3><a id="resolving">4.0 Resolving Synchronization Conflicts</a></h3>
The interface <code>SyncResolver</code> provides a way for an application to
decide manually what to do when a conflict occurs. When the <code>CachedRowSet</code>
method <code>acceptChanges</code> finishes and has detected one or more conflicts,
it throws a <code>SyncProviderException</code> object. An application can
catch the exception and
have it retrieve a <code>SyncResolver</code> object by calling the method
<code>SyncProviderException.getSyncResolver()</code>.
<P>
A <code>SyncResolver</code> object, which is a special kind of
<code>CachedRowSet</code> object or
a <code>JdbcRowSet</code> object that has implemented the <code>SyncResolver</code>
interface, examines the conflicts row by row. It is a duplicate of the
<code>RowSet</code> object being synchronized except that it contains only the data
from the data source this is causing a conflict. All of the other column values are
set to <code>null</code>. To navigate from one conflict value to another, a
<code>SyncResolver</code> object provides the methods <code>nextConflict</code> and
<code>previousConflict</code>.
<P>
The <code>SyncResolver</code> interface also
provides methods for doing the following:
<UL>
<LI>finding out whether the conflict involved an update, a delete, or an insert
<LI>getting the value in the data source that caused the conflict
<LI>setting the value that should be in the data source if it needs to be changed
or setting the value that should be in the <code>RowSet</code> object if it needs
to be changed
</UL>
<P>
When the <code>CachedRowSet</code> method <code>acceptChanges</code> is called, it
delegates to the <code>RowSet</code> object's <code>SyncProvider</code> object.
How the writer provided by that <code>SyncProvider</code> object is implemented
determines what level (grade) of checking for conflicts will be done. After all
checking for conflicts is completed and one or more conflicts has been found, the method
<code>acceptChanges</code> throws a <code>SyncProviderException</code> object. The
application can catch the exception and use it to obtain a <code>SyncResolver</code> object.
<P>
The application can then use <code>SyncResolver</code> methods to get information
about each conflict and decide what to do. If the application logic or the user
decides that a value in the <code>RowSet</code> object should be the one to
persist, the application or user can overwrite the data source value with it.
<P>
The comment for the <code>SyncResolver</code> interface has more detail.
<h3><a id="relspec">5.0 Related Specifications</a></h3>
<ul>
<li><a href="http://docs.oracle.com/javase/jndi/tutorial/index.html">JNDI</a>
<li><a href="{@docRoot}/java/util/logging/package-summary.html">Java Logging
APIs</a>
</ul>
<h3><a id="reldocs">6.0 Related Documentation</a></h3>
<ul>
<li><a href="http://docs.oracle.com/javase/tutorial/jdbc/">DataSource for JDBC
Connections</a>
</ul>
</body>
</html>

View file

@ -0,0 +1,162 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2003, 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.
-->
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://standards.iso.org/iso/9075/2002/12/sqlxml"
xmlns:sqlxml="http://standards.iso.org/iso/9075/2002/12/sqlxml">
<xsd:annotation>
<xsd:documentation>
ISO/IEC 9075-14:2003 (SQL/XML)
This document contains definitions of types and
annotations as specified in ISO/IEC 9075-14:2003.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType name="kindKeyword">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="PREDEFINED"/>
<xsd:enumeration value="DOMAIN"/>
<xsd:enumeration value="ROW"/>
<xsd:enumeration value="DISTINCT"/>
<xsd:enumeration value="ARRAY"/>
<xsd:enumeration value="MULTISET"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="typeKeyword">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="CHAR"/>
<xsd:enumeration value="VARCHAR"/>
<xsd:enumeration value="CLOB"/>
<xsd:enumeration value="BLOB"/>
<xsd:enumeration value="NUMERIC"/>
<xsd:enumeration value="DECIMAL"/>
<xsd:enumeration value="INTEGER"/>
<xsd:enumeration value="SMALLINT"/>
<xsd:enumeration value="BIGINT"/>
<xsd:enumeration value="FLOAT"/>
<xsd:enumeration value="REAL"/>
<xsd:enumeration value="DOUBLE PRECISION"/>
<xsd:enumeration value="BOOLEAN"/>
<xsd:enumeration value="DATE"/>
<xsd:enumeration value="TIME"/>
<xsd:enumeration value="TIME WITH TIME ZONE"/>
<xsd:enumeration value="TIMESTAMP"/>
<xsd:enumeration value="TIMESTAMP WITH TIME ZONE"/>
<xsd:enumeration value="INTERVAL YEAR"/>
<xsd:enumeration value="INTERVAL YEAR TO MONTH"/>
<xsd:enumeration value="INTERVAL MONTH"/>
<xsd:enumeration value="INTERVAL DAY"/>
<xsd:enumeration value="INTERVAL DAY TO HOUR"/>
<xsd:enumeration value="INTERVAL DAY TO MINUTE"/>
<xsd:enumeration value="INTERVAL DAY TO SECOND"/>
<xsd:enumeration value="INTERVAL HOUR"/>
<xsd:enumeration value="INTERVAL HOUR TO MINUTE"/>
<xsd:enumeration value="INTERVAL HOUR TO SECOND"/>
<xsd:enumeration value="INTERVAL MINUTE"/>
<xsd:enumeration value="INTERVAL MINUTE TO SECOND"/>
<xsd:enumeration value="INTERVAL SECOND"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="fieldType">
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="mappedType" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="sqltype">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="field" type="sqlxml:fieldType"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="kind"
type="sqlxml:kindKeyword"/>
<xsd:attribute name="name"
type="sqlxml:typeKeyword" use="optional"/>
<xsd:attribute name="length" type="xsd:integer"
use="optional"/>
<xsd:attribute name="maxLength" type="xsd:integer"
use="optional"/>
<xsd:attribute name="characterSetName" type="xsd:string"
use="optional"/>
<xsd:attribute name="collation" type="xsd:string"
use="optional"/>
<xsd:attribute name="precision" type="xsd:integer"
use="optional"/>
<xsd:attribute name="scale" type="xsd:integer"
use="optional"/>
<xsd:attribute name="maxExponent" type="xsd:integer"
use="optional"/>
<xsd:attribute name="minExponent" type="xsd:integer"
use="optional"/>
<xsd:attribute name="userPrecision" type="xsd:integer"
use="optional"/>
<xsd:attribute name="leadingPrecision" type="xsd:integer"
use="optional"/>
<xsd:attribute name="maxElements" type="xsd:integer"
use="optional"/>
<xsd:attribute name="catalogName" type="xsd:string"
use="optional"/>
<xsd:attribute name="schemaName" type="xsd:string"
use="optional"/>
<xsd:attribute name="domainName" type="xsd:string"
use="optional"/>
<xsd:attribute name="typeName" type="xsd:string"
use="optional"/>
<xsd:attribute name="mappedType" type="xsd:string"
use="optional"/>
<xsd:attribute name="mappedElementType" type="xsd:string"
use="optional"/>
<xsd:attribute name="final" type="xsd:boolean"
use="optional"/>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="objectType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="CATALOG" />
<xsd:enumeration value="SCHEMA" />
<xsd:enumeration value="BASE TABLE" />
<xsd:enumeration value="VIEWED TABLE" />
<xsd:enumeration value="CHARACTER SET" />
<xsd:enumeration value="COLLATION" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="sqlname">
<xsd:complexType>
<xsd:attribute name="type" type="sqlxml:objectType"
use="required" />
<xsd:attribute name="catalogName" type="xsd:string" />
<xsd:attribute name="schemaName" type="xsd:string" />
<xsd:attribute name="localName" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:schema>

View file

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2003, 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.
-->
<!-- WebRowSet XML Schema by Jonathan Bruce (Sun Microsystems Inc.) -->
<xs:schema targetNamespace="http://java.sun.com/xml/ns/jdbc" xmlns:wrs="http://java.sun.com/xml/ns/jdbc" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="webRowSet">
<xs:complexType>
<xs:sequence>
<xs:element ref="wrs:properties"/>
<xs:element ref="wrs:metadata"/>
<xs:element ref="wrs:data"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="columnValue" type="xs:anyType"/>
<xs:element name="updateValue" type="xs:anyType"/>
<xs:element name="properties">
<xs:complexType>
<xs:sequence>
<xs:element name="command" type="xs:string"/>
<xs:element name="concurrency" type="xs:string"/>
<xs:element name="datasource" type="xs:string"/>
<xs:element name="escape-processing" type="xs:string"/>
<xs:element name="fetch-direction" type="xs:string"/>
<xs:element name="fetch-size" type="xs:string"/>
<xs:element name="isolation-level" type="xs:string"/>
<xs:element name="key-columns">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="column" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="map">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="type" type="xs:string"/>
<xs:element name="class" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="max-field-size" type="xs:string"/>
<xs:element name="max-rows" type="xs:string"/>
<xs:element name="query-timeout" type="xs:string"/>
<xs:element name="read-only" type="xs:string"/>
<xs:element name="rowset-type" type="xs:string"/>
<xs:element name="show-deleted" type="xs:string"/>
<xs:element name="table-name" type="xs:string"/>
<xs:element name="url" type="xs:string"/>
<xs:element name="sync-provider">
<xs:complexType>
<xs:sequence>
<xs:element name="sync-provider-name" type="xs:string"/>
<xs:element name="sync-provider-vendor" type="xs:string"/>
<xs:element name="sync-provider-version" type="xs:string"/>
<xs:element name="sync-provider-grade" type="xs:string"/>
<xs:element name="data-source-lock" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="metadata">
<xs:complexType>
<xs:sequence>
<xs:element name="column-count" type="xs:string"/>
<xs:choice>
<xs:element name="column-definition" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="column-index" type="xs:string"/>
<xs:element name="auto-increment" type="xs:string"/>
<xs:element name="case-sensitive" type="xs:string"/>
<xs:element name="currency" type="xs:string"/>
<xs:element name="nullable" type="xs:string"/>
<xs:element name="signed" type="xs:string"/>
<xs:element name="searchable" type="xs:string"/>
<xs:element name="column-display-size" type="xs:string"/>
<xs:element name="column-label" type="xs:string"/>
<xs:element name="column-name" type="xs:string"/>
<xs:element name="schema-name" type="xs:string"/>
<xs:element name="column-precision" type="xs:string"/>
<xs:element name="column-scale" type="xs:string"/>
<xs:element name="table-name" type="xs:string"/>
<xs:element name="catalog-name" type="xs:string"/>
<xs:element name="column-type" type="xs:string"/>
<xs:element name="column-type-name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="data">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="currentRow" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="wrs:columnValue"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="insertRow" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="wrs:columnValue"/>
<xs:element ref="wrs:updateValue"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="deleteRow" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="wrs:columnValue"/>
<xs:element ref="wrs:updateValue"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="modifyRow" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="wrs:columnValue"/>
<xs:element ref="wrs:updateValue"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View file

@ -0,0 +1,44 @@
/*
* Copyright (c) 2014, 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.
*/
/**
* Defines the JDBC RowSet API.
*
* @uses javax.sql.rowset.RowSetFactory
*
* @moduleGraph
* @since 9
*/
module java.sql.rowset {
requires transitive java.logging;
requires transitive java.naming;
requires transitive java.sql;
exports javax.sql.rowset;
exports javax.sql.rowset.serial;
exports javax.sql.rowset.spi;
uses javax.sql.rowset.RowSetFactory;
}