Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vollt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sonia Zorba
vollt
Commits
708d175f
Commit
708d175f
authored
8 years ago
by
gmantele
Browse files
Options
Downloads
Patches
Plain Diff
[TAP] Possibility to add/replace TAP's input parameter controllers at init.
parent
8e2fa9ff
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tap/parameters/TAPParameters.java
+52
-5
52 additions, 5 deletions
src/tap/parameters/TAPParameters.java
with
52 additions
and
5 deletions
src/tap/parameters/TAPParameters.java
+
52
−
5
View file @
708d175f
...
...
@@ -42,7 +42,7 @@ import uws.job.parameters.UWSParameters;
* submitted by a TAP client to this TAP service.
*
* @author Grégory Mantelet (CDS;ARI)
* @version 2.1 (0
6
/201
6
)
* @version 2.1 (0
4
/201
7
)
*/
public
class
TAPParameters
extends
UWSParameters
{
...
...
@@ -55,7 +55,7 @@ public class TAPParameters extends UWSParameters {
* @param service Description of the TAP service in which the parameters are created and will be used.
*/
public
TAPParameters
(
final
ServiceConnection
service
){
super
(
TAP_PARAMETERS
,
buildDefaultControllers
(
service
));
super
(
TAP_PARAMETERS
,
buildDefaultControllers
(
service
,
null
));
}
/**
...
...
@@ -72,6 +72,24 @@ public class TAPParameters extends UWSParameters {
this
(
service
,
getParameters
(
request
));
}
/**
* Create a {@link TAPParameters} instance whose the parameters must be extracted from the given {@link HttpServletRequest}.
*
* @param request HTTP request containing the parameters to gather inside this class.
* @param service Description of the TAP service in which the parameters are created and will be used.
* @param controllers Additional/Replacing controllers to apply on some input parameters.
* <i>Ignored if <code>NULL</code>.</i>
*
* @throws TAPException If any error occurs while extracting the DALIParameters OR while setting a parameter.
*
* @see #getParameters(HttpServletRequest)
*
* @since 2.1
*/
public
TAPParameters
(
final
HttpServletRequest
request
,
final
ServiceConnection
service
,
final
Map
<
String
,
InputParamController
>
controllers
)
throws
TAPException
{
this
(
service
,
getParameters
(
request
),
controllers
);
}
/**
* Create a {@link TAPParameters} instance whose the parameters are given in parameter.
*
...
...
@@ -79,9 +97,25 @@ public class TAPParameters extends UWSParameters {
* @param params List of parameters to load inside this object.
*
* @throws TAPException If any error occurs while extracting the DALIParameters OR while setting a parameter.
*
* @see #TAPParameters(ServiceConnection, Map, Map)
*/
public
TAPParameters
(
final
ServiceConnection
service
,
final
Map
<
String
,
Object
>
params
)
throws
TAPException
{
super
(
TAP_PARAMETERS
,
buildDefaultControllers
(
service
));
this
(
service
,
params
,
null
);
}
/**
* Create a {@link TAPParameters} instance whose the parameters are given in parameter.
*
* @param service Description of the TAP service. Limits of the standard TAP parameters are listed in it.
* @param params List of parameters to load inside this object.
* @param controllers Additional/Replacing controllers to apply on some input parameters.
* <i>Ignored if <code>NULL</code>.</i>
*
* @throws TAPException If any error occurs while extracting the DALIParameters OR while setting a parameter.
*/
public
TAPParameters
(
final
ServiceConnection
service
,
final
Map
<
String
,
Object
>
params
,
final
Map
<
String
,
InputParamController
>
controllers
)
throws
TAPException
{
super
(
TAP_PARAMETERS
,
buildDefaultControllers
(
service
,
controllers
));
if
(
params
!=
null
&&
!
params
.
isEmpty
()){
// Deal with the UPLOAD parameter(s):
...
...
@@ -111,13 +145,17 @@ public class TAPParameters extends UWSParameters {
* </i></p>
*
* @param service Description of the TAP service.
* @param customControllers Additional/Replacing controllers to apply on some input parameters.
* <i>Ignored if <code>NULL</code>.</i>
*
* @return Map of all default controllers.
*
* @since 2.0
*/
protected
static
final
Map
<
String
,
InputParamController
>
buildDefaultControllers
(
final
ServiceConnection
service
){
protected
static
final
Map
<
String
,
InputParamController
>
buildDefaultControllers
(
final
ServiceConnection
service
,
final
Map
<
String
,
InputParamController
>
customControllers
){
Map
<
String
,
InputParamController
>
controllers
=
new
HashMap
<
String
,
InputParamController
>(
10
);
// Set the default controllers:
controllers
.
put
(
TAPJob
.
PARAM_EXECUTION_DURATION
,
new
TAPExecutionDurationController
(
service
));
controllers
.
put
(
TAPJob
.
PARAM_DESTRUCTION_TIME
,
new
TAPDestructionTimeController
(
service
));
controllers
.
put
(
TAPJob
.
PARAM_REQUEST
,
new
StringParamController
(
TAPJob
.
PARAM_REQUEST
,
null
,
new
String
[]{
TAPJob
.
REQUEST_DO_QUERY
,
TAPJob
.
REQUEST_GET_CAPABILITIES
},
true
));
...
...
@@ -126,6 +164,15 @@ public class TAPParameters extends UWSParameters {
controllers
.
put
(
TAPJob
.
PARAM_QUERY
,
new
StringParamController
(
TAPJob
.
PARAM_QUERY
));
controllers
.
put
(
TAPJob
.
PARAM_FORMAT
,
new
FormatController
(
service
));
controllers
.
put
(
TAPJob
.
PARAM_MAX_REC
,
new
MaxRecController
(
service
));
// Add/Replace with the given controllers:
if
(
customControllers
!=
null
){
for
(
Map
.
Entry
<
String
,
InputParamController
>
item
:
customControllers
.
entrySet
()){
if
(
item
.
getKey
()
!=
null
&&
item
.
getValue
()
!=
null
)
controllers
.
put
(
item
.
getKey
(),
item
.
getValue
());
}
}
return
controllers
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment