public interface ServiceConnection
Through this object, it is possible to configure the different limits and formats, but also to list all available tables and columns, to declare geometry features as well as all allowed user defined functions and to say where log and other kinds of files must be stored.
Modifier and Type | Interface and Description |
---|---|
static class |
ServiceConnection.LimitUnit
List of possible limit units.
|
Modifier and Type | Method and Description |
---|---|
boolean |
fixOnFailEnabled()
[MANDATORY]
|
java.lang.String |
getAvailability()
[OPTIONAL]
|
java.util.Collection<java.lang.String> |
getCoordinateSystems()
[OPTIONAL]
|
int[] |
getExecutionDuration()
[OPTIONAL]
|
TAPFactory |
getFactory()
[MANDATORY]
|
int[] |
getFetchSize()
[OPTIONAL]
|
UWSFileManager |
getFileManager()
[MANDATORY]
|
java.util.Collection<java.lang.String> |
getGeometries()
[OPTIONAL]
|
TAPLog |
getLogger()
[MANDATORY]
|
long |
getMaxUploadSize()
[OPTIONAL]
|
int |
getNbMaxAsyncJobs()
[OPTIONAL]
|
OutputFormat |
getOutputFormat(java.lang.String mimeOrAlias)
[MANDATORY]
|
java.util.Iterator<OutputFormat> |
getOutputFormats()
[MANDATORY]
|
int[] |
getOutputLimit()
[OPTIONAL]
|
ServiceConnection.LimitUnit[] |
getOutputLimitType()
[OPTIONAL]
|
java.lang.String |
getProviderDescription()
[OPTIONAL]
|
java.lang.String |
getProviderName()
[OPTIONAL]
|
int[] |
getRetentionPeriod()
[OPTIONAL]
|
TAPMetadata |
getTAPMetadata()
[MANDATORY]
|
java.util.Collection<FunctionDef> |
getUDFs()
[OPTIONAL]
|
long[] |
getUploadLimit()
[OPTIONAL]
|
ServiceConnection.LimitUnit[] |
getUploadLimitType()
[OPTIONAL]
|
UserIdentifier |
getUserIdentifier()
[OPTIONAL]
|
boolean |
isAvailable()
[MANDATORY]
|
void |
setAvailable(boolean isAvailable,
java.lang.String message)
[MANDATORY]
|
boolean |
uploadEnabled()
[MANDATORY]
|
java.lang.String getProviderName()
Name of the service provider ; it can be an organization as an individual person.
There is no restriction on the syntax or on the label to use ; this information is totally free
It will be used as additional information (INFO tag) in any VOTable and HTML output.
java.lang.String getProviderDescription()
Description of the service provider.
It will be used as additional information (INFO tag) in any VOTable output.
boolean isAvailable()
This function tells whether the TAP service is available (that's to say, "able to execute requests" ; resources like /availability, /capabilities and /tables may still work).
A message explaining the current state of the TAP service could be provided thanks to getAvailability()
.
java.lang.String getAvailability()
Get an explanation about the current TAP service state (working or not). This message aims to provide more details to the users about the availability of this service, or more particularly about its unavailability.
void setAvailable(boolean isAvailable, java.lang.String message)
This function sets the state of the whole TAP service. If true, all TAP resources will be able to execute resources. If false, /sync and /async won't answer any more to requests and a HTTP-503 (Service unavailable) error will be returned.
isAvailable
- true to enable all resources, false to forbid /sync and /async (all other resources will still be available).message
- A message describing the current state of the service. If NULL, a default message may be set by the library.int[] getRetentionPeriod()
Get the limit of the retention period (in seconds).
It is the maximum period while an asynchronous job can leave in the jobs list and so can stay on the server.
Important notes:
int[] getExecutionDuration()
Get the limit of the job execution duration (in milliseconds).
It is the duration of a running job (including the query execution). This duration is used for synchronous AND asynchronous jobs.
Important notes:
int[] getOutputLimit()
Get the limit of the job execution result.
This value will limit the size of the query results, either in rows or in bytes.
The type of limit is defined by the function getOutputLimitType()
.
Important notes:
getOutputLimitType()
.
Particularly, the type given by the N-th item of getOutputLimitType()
must correspond to the N-th limit returned by this function.Important note:
Currently, the default implementations of the library is only able to deal with output limits in ROWS.
Anyway, in order to save performances, it is strongly recommended to use ROWS limit rather than in bytes. Indeed, the rows limit can be taken
into account at the effective execution of the query (so before getting the result), on the contrary of the bytes limit which
will be applied on the query result.
getOutputLimitType()
ServiceConnection.LimitUnit[] getOutputLimitType()
Get the type of each output limit set by this service connection (and accessible with getOutputLimit()
).
Important notes:
getOutputLimit()
.
Particularly, the type given by the N-th item of this function must correspond to the N-th limit returned by getOutputLimit()
.Important note:
Currently, the default implementations of the library is only able to deal with output limits in ROWS.
Anyway, in order to save performances, it is strongly recommended to use ROWS limit rather than in bytes. Indeed, the rows limit can be taken
into account at the effective execution of the query (so before getting the result), on the contrary of the bytes limit which
will be applied on the query result.
getOutputLimit()
UserIdentifier getUserIdentifier()
Get the object to use in order to identify users at the origin of requests.
UserIdentifier
instance otherwise.boolean uploadEnabled()
This function lets enable or disable the upload capability of this TAP service.
Note: If the upload is disabled, the request is aborted and an HTTP-400 error is thrown each time some tables are uploaded.
long[] getUploadLimit()
Get the maximum size of EACH uploaded table.
This value is expressed either in rows or in bytes.
The unit limit is defined by the function getUploadLimitType()
.
Important notes:
getUploadLimitType()
.
Particularly, the type given by the N-th item of
getUploadLimitType()
must correspond to the N-th limit
returned by this function.Important note: To save performances, it is recommended to use BYTES limit rather than in rows. Indeed, the bytes limit can be taken into account at directly when reading the bytes of the request, on the contrary of the rows limit which requires to parse the uploaded tables.
getUploadLimitType()
ServiceConnection.LimitUnit[] getUploadLimitType()
Get the type of each upload limit set by this service connection (and
accessible with getUploadLimit()
).
Important notes:
getUploadLimit()
.
Particularly, the type given by the N-th item of this function must
correspond to the N-th limit returned by getUploadLimit()
.
Important note: To save performances, it is recommended to use BYTES limit rather than in rows. Indeed, the bytes limit can be taken into account at directly when reading the bytes of the request, on the contrary of the rows limit which requires to parse the uploaded tables.
getUploadLimit()
long getMaxUploadSize()
Get the maximum size of the whole set of all tables uploaded in one request. This size is expressed in bytes.
NOTE: This value can be negative. In such case, there will be no limit on the size of an HTTP request.
TAPMetadata getTAPMetadata()
Get the list of all available tables and columns.
This object is really important since it lets the library check ADQL queries properly and set the good type and formatting in the query results.
java.util.Collection<java.lang.String> getCoordinateSystems()
Get the list of all allowed coordinate systems.
Special valuesTwo special values can be returned by this function:
Each item of this list is a pattern and not a simple coordinate system. Thus each item MUST respect the following syntax:
{framePattern} {refposPattern} {flavorPattern}
Contrary to a coordinate system expression, all these 3 information are required. Each may take 3 kinds of value:
({value1}|{value2}|...)
(i.e. "(ICRS|FK4)"),
For instance: (ICRS|FK4) HELIOCENTER *
is a good syntax,
but not ICRS
or ICRS HELIOCENTER
.
Note: Even if not explicitly part of the possible values, the default value of each part (i.e. UNKNOWNFRAME for frame) is always taken into account by the library. Particularly, the empty string will always be allowed even if not explicitly listed in the list returned by this function.
java.util.Collection<java.lang.String> getGeometries()
Get the list of all allowed geometrical functions.
Special valuesTwo special values can be returned by this function:
Each item of the returned list MUST be a function name (i.e. "CONTAINS", "POINT"). It can also be a type of STC region to forbid (i.e. "POSITION", "UNION").
The given names are not case sensitive.
java.util.Collection<FunctionDef> getUDFs()
Get the list of all allowed User Defined Functions (UDFs).
Special valuesTwo special values can be returned by this function:
Each item of the returned list MUST be an instance of FunctionDef
.
int getNbMaxAsyncJobs()
Get the maximum number of asynchronous jobs that can run in the same time.
A null or negative value means no limit on the number of running asynchronous jobs.
TAPLog getLogger()
Get the logger to use in the whole service when any error, warning or info happens.
IMPORTANT: If NULL is returned by this function, grave errors will occur while executing a query or managing an error. It is strongly recommended to provide a logger, even a basic implementation.
Piece of advice:
A default implementation like DefaultTAPLog
would be most of time largely enough.
TAPLog
.TAPFactory getFactory()
Get the object able to build other objects essentials to configure the TAP service or to run every queries.
IMPORTANT: If NULL is returned by this function, grave errors will occur while initializing the service.
Piece of advice:
The TAPFactory
is an interface which contains a lot of functions to implement.
It is rather recommended to extend AbstractTAPFactory
: just 2 functions
(TAPFactory.freeConnection(DBConnection)
and TAPFactory.getConnection(String)
)
will have to be implemented.
TAPFactory
.AbstractTAPFactory
UWSFileManager getFileManager()
Get the object in charge of the files management. This object manages log, error, result and backup files of the whole service.
IMPORTANT: If NULL is returned by this function, grave errors will occur while initializing the service.
Piece of advice:
The library provides a default implementation of the interface UWSFileManager
:
LocalUWSFileManager
, which stores all files on the local file-system.
UWSFileManager
.java.util.Iterator<OutputFormat> getOutputFormats()
Get the list of all available output formats.
IMPORTANT:
OutputFormat getOutputFormat(java.lang.String mimeOrAlias)
Get the output format having the given MIME type (or short MIME type ~ alias).
IMPORTANT:
This function MUST always return an OutputFormat
instance when the MIME type "votable" is given in parameter.
mimeOrAlias
- MIME type or short MIME type of the format to get.OutputFormat
or NULL if not found.int[] getFetchSize()
Get the size of result blocks to fetch from the database.
Rather than fetching a query result in a whole, it may be possible to specify to the database that results may be retrieved by blocks whose the size can be specified by this function. If supported by the DBMS and the JDBC driver, this feature may help sparing memory and avoid too much waiting time from the TAP /sync users (and thus, avoiding some HTTP client timeouts).
Note:
Generally, this feature is well supported by DBMS. But for that, the used JDBC driver must use
the V3 protocol. If anyway, this feature is supported neither by the DBMS, the JDBC driver nor your
DBConnection
, no error will be thrown if a value is returned by this function: it will be silently
ignored by the library.
DBConnection
will be used.
[0]=fetchSize for async queries, [1]=fetchSize for sync queries.
If [1] is omitted, it will be considered as equals to [0].
If a fetchSize is negative or null, the default value of your JDBC driver will be used.boolean fixOnFailEnabled()
This function tells whether TAP-Lib should automatically try to fix a query whose parsing failed because of a token error. After this fix attempt the query is parsed again for a last time.