public abstract class AbstractTAPFactory extends TAPFactory
TAPFactory
function.
Only the functions related with the database connection stay abstract.Modifier and Type | Field and Description |
---|---|
protected ServiceErrorWriter |
errorWriter
The error writer to use when any error occurs while executing a resource or to format an error occurring while executing an asynchronous job.
|
service
Modifier | Constructor and Description |
---|---|
protected |
AbstractTAPFactory(ServiceConnection service)
Build a basic TAPFactory.
|
protected |
AbstractTAPFactory(ServiceConnection service,
ServiceErrorWriter errorWriter)
Build a basic TAPFactory.
|
Modifier and Type | Method and Description |
---|---|
ADQLExecutor |
createADQLExecutor()
Note:
Unless the standard implementation -
ADQLExecutor - does not fit exactly your needs,
it should not be necessary to extend this class and to extend this function (implemented here by default). |
ADQLParser |
createADQLParser()
Note:
This function should be extended if you want to customize the ADQL grammar.
|
protected QueryChecker |
createQueryChecker(java.util.Collection<TAPTable> tables)
Create an object able to check the consistency between the ADQL query and the database.
|
QueryChecker |
createQueryChecker(TAPSchema uploadSchema)
This implementation gathers all tables published in this TAP service and those uploaded
by the user.
|
ADQLQueryFactory |
createQueryFactory()
Note:
This function should be extended if you have customized the creation of any
ADQLQuery part ; it could be the addition of one or several user defined function
or the modification of any ADQL function or clause specific to your implementation. |
protected TAPJob |
createTAPJob(javax.servlet.http.HttpServletRequest request,
JobOwner owner)
This implementation provides a basic
TAPJob instance. |
protected TAPJob |
createTAPJob(java.lang.String jobId,
long creationTime,
JobOwner owner,
TAPParameters params,
long quote,
long startTime,
long endTime,
java.util.List<Result> results,
ErrorSummary error)
This implementation provides a basic
TAPJob instance. |
TAPParameters |
createTAPParameters(javax.servlet.http.HttpServletRequest request)
This implementation extracts standard TAP parameters from the given request.
|
TAPParameters |
createTAPParameters(java.util.Map<java.lang.String,java.lang.Object> params)
This implementation extracts standard TAP parameters from the given request.
|
Uploader |
createUploader(DBConnection dbConn)
This implementation just create an
Uploader instance with the given database connection. |
UWSService |
createUWS()
This implementation just create a
UWSService instance. |
UWSBackupManager |
createUWSBackupManager(UWSService uws)
This implementation does not provided a backup manager.
|
ServiceErrorWriter |
getErrorWriter()
Get the object to use when an error must be formatted and written to the user.
|
createJob, createJob, createJobThread, createRequestParser, createUWSParameters, createUWSParameters, destroy, freeConnection, getConnection
protected final ServiceErrorWriter errorWriter
protected AbstractTAPFactory(ServiceConnection service) throws java.lang.NullPointerException
service
- Configuration of the TAP service. MUST NOT be NULLjava.lang.NullPointerException
- If the given ServiceConnection
is NULL.AbstractTAPFactory(ServiceConnection, ServiceErrorWriter)
protected AbstractTAPFactory(ServiceConnection service, ServiceErrorWriter errorWriter) throws java.lang.NullPointerException
Build a basic TAPFactory. Nothing is done except setting the service connection and the given error writer.
Then the error writer will be used when creating a UWS service and a job thread.
service
- Configuration of the TAP service. MUST NOT be NULLerrorWriter
- Object to use to format and write the errors for the user.java.lang.NullPointerException
- If the given ServiceConnection
is NULL.TAPFactory.TAPFactory(ServiceConnection)
public final ServiceErrorWriter getErrorWriter()
TAPFactory
Get the object to use when an error must be formatted and written to the user.
This formatted error will be either written in an HTTP response or in a job error summary.
getErrorWriter
in class TAPFactory
public ADQLExecutor createADQLExecutor() throws TAPException
Note:
Unless the standard implementation - ADQLExecutor
- does not fit exactly your needs,
it should not be necessary to extend this class and to extend this function (implemented here by default).
createADQLExecutor
in class TAPFactory
TAPException
- If any error occurs while creating an ADQL executor.public ADQLParser createADQLParser() throws TAPException
Note: This function should be extended if you want to customize the ADQL grammar.
createADQLParser
in class TAPFactory
TAPException
- If any error occurs while creating an ADQL parser.public ADQLQueryFactory createQueryFactory() throws TAPException
Note:
This function should be extended if you have customized the creation of any
ADQLQuery
part ; it could be the addition of one or several user defined function
or the modification of any ADQL function or clause specific to your implementation.
createQueryFactory
in class TAPFactory
ADQLQuery
factory.TAPException
- If any error occurs while creating the factory.public final QueryChecker createQueryChecker(TAPSchema uploadSchema) throws TAPException
This implementation gathers all tables published in this TAP service and those uploaded
by the user. Then it calls createQueryChecker(Collection)
with this list in order
to create a query checked.
Note:
This function can not be overridded, but createQueryChecker(Collection)
can be.
createQueryChecker
in class TAPFactory
uploadSchema
- ADQL schema containing the description of all uploaded tables.TAPException
- If any error occurs while creating a query checker.protected QueryChecker createQueryChecker(java.util.Collection<TAPTable> tables) throws TAPException
Create an object able to check the consistency between the ADQL query and the database. That's to say, it checks whether the tables and columns used in the query really exist in the database.
Note:
This implementation just create a DBChecker
instance with the list given in parameter.
tables
- List of all available tables (and indirectly, columns).TAPException
- If any error occurs while creating the query checker.public Uploader createUploader(DBConnection dbConn) throws TAPException
This implementation just create an Uploader
instance with the given database connection.
Note:
This function should be overrided if you need to change the DB name of the TAP_UPLOAD schema.
Indeed, by overriding this function you can specify a given TAPSchema to use as TAP_UPLOAD schema
in the constructor of Uploader
. But do not forget that this TAPSchema
instance MUST have
an ADQL name equals to "TAP_UPLOAD", otherwise, a TAPException will be thrown.
createUploader
in class TAPFactory
dbConn
- The database connection which has requested an Uploader
.Uploader
.TAPException
- If any error occurs while creating an Uploader
instance.public UWSService createUWS() throws TAPException
This implementation just create a UWSService
instance.
Note: This implementation is largely enough for a TAP service. It is not recommended to override this function.
createUWS
in class TAPFactory
TAPException
- If any error occurs while creating this UWS service.public UWSBackupManager createUWSBackupManager(UWSService uws) throws TAPException
This implementation does not provided a backup manager. It means that no asynchronous job will be restored and backuped.
You must override this function if you want enable the backup feature.
createUWSBackupManager
in class TAPFactory
uws
- The UWS service which has to be backuped and restored.TAPException
- If any error occurs while creating this backup manager.protected TAPJob createTAPJob(javax.servlet.http.HttpServletRequest request, JobOwner owner) throws UWSException
This implementation provides a basic TAPJob
instance.
If you need to add or modify the behavior of some functions of a TAPJob
,
you must override this function and return your own extension of TAPJob
.
createTAPJob
in class TAPFactory
request
- Request which contains all parameters needed to set correctly the asynchronous job to create.owner
- The user which has requested the job creation.UWSException
- If any error occurs while reading the parameters in the request or while creating the job.protected TAPJob createTAPJob(java.lang.String jobId, long creationTime, JobOwner owner, TAPParameters params, long quote, long startTime, long endTime, java.util.List<Result> results, ErrorSummary error) throws UWSException
This implementation provides a basic TAPJob
instance.
If you need to add or modify the behavior of some functions of a
TAPJob
, you must override this function and return your own
extension of TAPJob
.
createTAPJob
in class TAPFactory
jobId
- ID of the job (NOT NULL).creationTime
- Creation date/time of the job (SHOULD NOT BE
NEGATIVE OR NULL).owner
- Owner of the job.params
- List of all input job parameters.quote
- Its quote (in seconds).startTime
- Date/Time of the start of this job.endTime
- Date/Time of the end of this job.results
- All results of this job.error
- The error which ended the job to create.UWSException
- If there is an error while creating the job.public TAPParameters createTAPParameters(javax.servlet.http.HttpServletRequest request) throws TAPException
This implementation extracts standard TAP parameters from the given request.
Non-standard TAP parameters are added in a map inside the returned TAPParameters
object
and are accessible with UWSParameters.get(String)
and UWSParameters.getAdditionalParameters()
.
However, if you want to manage them in another way, you must extend TAPParameters
and override
this function in order to return an instance of your extension.
createTAPParameters
in class TAPFactory
request
- The HTTP request containing the TAP parameters to extract.TAPException
- If any error occurs while extracting the parameters.public TAPParameters createTAPParameters(java.util.Map<java.lang.String,java.lang.Object> params) throws TAPException
This implementation extracts standard TAP parameters from the given request.
Non-standard TAP parameters are added in a map inside the returned TAPParameters
object
and are accessible with UWSParameters.get(String)
and UWSParameters.getAdditionalParameters()
.
However, if you want to manage them in another way, you must extend TAPParameters
and override
this function in order to return an instance of your extension.
createTAPParameters
in class TAPFactory
params
- Map containing all parameters.TAPException
- If any error occurs while creating the TAPParameters
object.