public class Uploader
extends java.lang.Object
This class manages particularly the upload limit in rows and in bytes by
creating a LimitedTableIterator
with a VOTableIterator
.
LimitedTableIterator
,
VOTableIterator
Modifier and Type | Field and Description |
---|---|
protected DBConnection |
dbConn
Connection to the "database" (which lets upload the content of any given
VOTable).
|
protected int |
limit
Limit on the number of rows or bytes (depending of
limitUnit )
allowed to be uploaded in once (whatever is the number of tables). |
protected ServiceConnection.LimitUnit |
limitUnit
Type of limit to set: ROWS or BYTES.
|
protected int |
nbRows
Number of rows already loaded.
|
protected ServiceConnection |
service
Specification of the TAP service.
|
protected TAPSchema |
uploadSchema
Description of the TAP_UPLOAD schema to use.
|
Constructor and Description |
---|
Uploader(ServiceConnection service,
DBConnection dbConn)
Build an
Uploader object. |
Uploader(ServiceConnection service,
DBConnection dbConn,
TAPSchema uplSchema)
Build an
Uploader object. |
Modifier and Type | Method and Description |
---|---|
protected void |
dropUploadedTables()
Drop all tables already uploaded in the database.
|
TAPSchema |
upload(DALIUpload[] uploads)
Upload all the given VOTable inputs.
|
protected final ServiceConnection service
protected final DBConnection dbConn
protected final TAPSchema uploadSchema
protected final ServiceConnection.LimitUnit limitUnit
protected final int limit
limitUnit
)
allowed to be uploaded in once (whatever is the number of tables).protected int nbRows
public Uploader(ServiceConnection service, DBConnection dbConn) throws TAPException
Uploader
object.service
- Specification of the TAP service using this uploader.dbConn
- A valid (open) connection to the "database".TAPException
- If any error occurs while building this
Uploader
.public Uploader(ServiceConnection service, DBConnection dbConn, TAPSchema uplSchema) throws TAPException
Uploader
object.service
- Specification of the TAP service using this uploader.dbConn
- A valid (open) connection to the "database".TAPException
- If any error occurs while building this
Uploader
.public TAPSchema upload(DALIUpload[] uploads) throws TAPException
Note 1:
The TAPTable
objects representing the uploaded tables will be
associated with the TAP_UPLOAD schema specified at the creation of this
Uploader
. If no such schema was specified, a default one (whose
DB name will be equals to the ADQL name, that's to say
TAPMetadata.STDSchema.UPLOADSCHEMA
) is created, will be associated with the
uploaded tables and will be returned by this function.
Note 2:
In case of error while ingesting one or all of the uploaded tables,
all tables created in the database before the error occurs are dropped
(see dropUploadedTables()
).
uploads
- Array of tables to upload.TAPSchema
containing the list and the description of
all uploaded tables.TAPException
- If any error occurs while reading the VOTable inputs
or while uploading the table into the "database".DBConnection.addUploadedTable(TAPTable, tap.data.TableIterator)
protected void dropUploadedTables()