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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sonia Zorba
vollt
Commits
16e26982
Commit
16e26982
authored
8 years ago
by
gmantele
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
git://github.com/vforchi/taplib
into vforchi-master
parents
0422fb7d
0411e5da
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
build.gradle
+4
-0
4 additions, 0 deletions
build.gradle
src/tap/config/ConfigurableServiceConnection.java
+17
-101
17 additions, 101 deletions
src/tap/config/ConfigurableServiceConnection.java
with
21 additions
and
101 deletions
build.gradle
+
4
−
0
View file @
16e26982
...
...
@@ -28,5 +28,9 @@ dependencies {
testCompile
fileTree
(
dir:
'lib'
,
include:
'astroh2-0.3.jar'
)
}
compileJava
{
options
.
encoding
=
"UTF-8"
}
sourceSets
.
main
.
java
.
srcDirs
=
[
"src"
]
sourceSets
.
test
.
java
.
srcDirs
=
[
"test"
]
This diff is collapsed.
Click to expand it.
src/tap/config/ConfigurableServiceConnection.java
+
17
−
101
View file @
16e26982
...
...
@@ -19,77 +19,6 @@ package tap.config;
* Copyright 2016 - Astronomisches Rechen Institut (ARI)
*/
import
static
tap
.
config
.
TAPConfiguration
.
DEFAULT_ASYNC_FETCH_SIZE
;
import
static
tap
.
config
.
TAPConfiguration
.
DEFAULT_DIRECTORY_PER_USER
;
import
static
tap
.
config
.
TAPConfiguration
.
DEFAULT_EXECUTION_DURATION
;
import
static
tap
.
config
.
TAPConfiguration
.
DEFAULT_GROUP_USER_DIRECTORIES
;
import
static
tap
.
config
.
TAPConfiguration
.
DEFAULT_MAX_ASYNC_JOBS
;
import
static
tap
.
config
.
TAPConfiguration
.
DEFAULT_RETENTION_PERIOD
;
import
static
tap
.
config
.
TAPConfiguration
.
DEFAULT_SYNC_FETCH_SIZE
;
import
static
tap
.
config
.
TAPConfiguration
.
DEFAULT_UPLOAD_MAX_FILE_SIZE
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_ASYNC_FETCH_SIZE
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_COORD_SYS
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_DEFAULT_EXECUTION_DURATION
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_DEFAULT_OUTPUT_LIMIT
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_DEFAULT_RETENTION_PERIOD
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_DEFAULT_UPLOAD_LIMIT
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_DIRECTORY_PER_USER
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_FILE_MANAGER
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_FILE_ROOT_PATH
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_GEOMETRIES
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_GROUP_USER_DIRECTORIES
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_LOG_ROTATION
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_MAX_ASYNC_JOBS
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_MAX_EXECUTION_DURATION
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_MAX_OUTPUT_LIMIT
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_MAX_RETENTION_PERIOD
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_MAX_UPLOAD_LIMIT
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_METADATA
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_METADATA_FILE
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_MIN_LOG_LEVEL
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_OUTPUT_FORMATS
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_PROVIDER_NAME
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_SERVICE_DESCRIPTION
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_SYNC_FETCH_SIZE
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_TAP_FACTORY
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_UDFS
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_UPLOAD_ENABLED
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_UPLOAD_MAX_FILE_SIZE
;
import
static
tap
.
config
.
TAPConfiguration
.
KEY_USER_IDENTIFIER
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_ALL
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_ANY
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_CSV
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_DB
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_FITS
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_HTML
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_JSON
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_LOCAL
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_NONE
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_SV
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_TEXT
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_TSV
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_VOT
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_VOTABLE
;
import
static
tap
.
config
.
TAPConfiguration
.
VALUE_XML
;
import
static
tap
.
config
.
TAPConfiguration
.
fetchClass
;
import
static
tap
.
config
.
TAPConfiguration
.
getProperty
;
import
static
tap
.
config
.
TAPConfiguration
.
hasConstructor
;
import
static
tap
.
config
.
TAPConfiguration
.
isClassName
;
import
static
tap
.
config
.
TAPConfiguration
.
newInstance
;
import
static
tap
.
config
.
TAPConfiguration
.
parseLimit
;
import
java.io.File
;
import
java.io.IOException
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.InvocationTargetException
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Properties
;
import
adql.db.FunctionDef
;
import
adql.db.STCS
;
import
adql.parser.ParseException
;
...
...
@@ -99,13 +28,7 @@ import tap.TAPException;
import
tap.TAPFactory
;
import
tap.db.DBConnection
;
import
tap.db.JDBCConnection
;
import
tap.formatter.FITSFormat
;
import
tap.formatter.HTMLFormat
;
import
tap.formatter.JSONFormat
;
import
tap.formatter.OutputFormat
;
import
tap.formatter.SVFormat
;
import
tap.formatter.TextFormat
;
import
tap.formatter.VOTableFormat
;
import
tap.formatter.*
;
import
tap.log.DefaultTAPLog
;
import
tap.log.TAPLog
;
import
tap.metadata.TAPMetadata
;
...
...
@@ -118,6 +41,14 @@ import uws.service.file.LocalUWSFileManager;
import
uws.service.file.UWSFileManager
;
import
uws.service.log.UWSLog.LogLevel
;
import
java.io.File
;
import
java.io.IOException
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.*
;
import
static
tap
.
config
.
TAPConfiguration
.*;
/**
* <p>Concrete implementation of {@link ServiceConnection}, fully parameterized with a TAP configuration file.</p>
*
...
...
@@ -326,42 +257,27 @@ public final class ConfigurableServiceConnection implements ServiceConnection {
/**
* <p>Resolve the given file name/path.</p>
*
* <p>Only the URI protocol "file:" is allowed. If the protocol is different a {@link TAPException} is thrown.</p>
*
* <p>
* If not an absolute
URI
, the given path may be either relative or absolute. A relative path is always considered
* If not an absolute
path
, the given path may be either relative or absolute. A relative path is always considered
* as relative from the Web Application directory (supposed to be given in 2nd parameter).
* </p>
*
* @param filePath
URI/
Path/Name of the file to get.
* @param filePath Path/Name of the file to get.
* @param webAppRootPath Web Application directory local path.
* @param propertyName Name of the property which gives the given file path.
*
* @return The specified File instance.
*
* @throws TAPException If the given URI is malformed or if the used URI scheme is different from "file:".
*/
protected
static
final
File
getFile
(
final
String
filePath
,
final
String
webAppRootPath
,
final
String
propertyName
)
throws
TAPException
{
protected
static
final
File
getFile
(
final
String
filePath
,
final
String
webAppRootPath
,
final
String
propertyName
)
{
if
(
filePath
==
null
)
return
null
;
try
{
URI
uri
=
new
URI
(
filePath
);
if
(
uri
.
isAbsolute
()){
if
(
uri
.
getScheme
().
equalsIgnoreCase
(
"file"
))
return
new
File
(
uri
);
else
throw
new
TAPException
(
"Incorrect file URI for the property \""
+
propertyName
+
"\": \""
+
filePath
+
"\"! Only URI with the protocol \"file:\" are allowed."
);
}
else
{
File
f
=
new
File
(
filePath
);
if
(
f
.
isAbsolute
())
return
f
;
else
return
new
File
(
webAppRootPath
,
filePath
);
}
}
catch
(
URISyntaxException
use
){
throw
new
TAPException
(
"Incorrect file URI for the property \""
+
propertyName
+
"\": \""
+
filePath
+
"\"! Bad syntax for the given file URI."
,
use
);
}
File
f
=
new
File
(
filePath
);
if
(
f
.
isAbsolute
())
return
f
;
else
return
new
File
(
webAppRootPath
,
filePath
);
}
/**
...
...
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