Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vlkb-soda
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
ViaLactea
vlkb-soda
Commits
f67a5012
Commit
f67a5012
authored
4 months ago
by
Robert Butora
Browse files
Options
Downloads
Patches
Plain Diff
resolver: adds support for HTTP-dav (http:// https://) and files (
file://
)
parent
a3330a6e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
data-access/servlet/src/main/java/common/resolver/ResolverFromId.java
+98
-34
98 additions, 34 deletions
...servlet/src/main/java/common/resolver/ResolverFromId.java
data-access/servlet/src/main/java/cutout/SodaImpl.java
+8
-2
8 additions, 2 deletions
data-access/servlet/src/main/java/cutout/SodaImpl.java
with
106 additions
and
36 deletions
data-access/servlet/src/main/java/common/resolver/ResolverFromId.java
+
98
−
34
View file @
f67a5012
...
@@ -27,52 +27,116 @@ class ResolverFromId implements Resolver
...
@@ -27,52 +27,116 @@ class ResolverFromId implements Resolver
{
{
LOGGER
.
fine
(
"trace "
+
pubdid
);
LOGGER
.
fine
(
"trace "
+
pubdid
);
boolean
isIvoid
=
pubdid
.
substring
(
0
,
6
).
equals
(
"ivo://"
);
final
boolean
isIvoid
=
pubdid
.
substring
(
0
,
6
).
equals
(
"ivo://"
);
final
boolean
isDav
=
pubdid
.
startsWith
(
"http://"
)
||
pubdid
.
startsWith
(
"https://"
);
final
boolean
isFile
=
pubdid
.
startsWith
(
"file://"
);
if
(
isIvoid
)
if
(
isIvoid
)
{
{
LOGGER
.
finer
(
"isIvoid"
);
resolveIvoid
(
pubdid
);
resolveIvoid
(
pubdid
);
// FIXME resolve subsurveyId by matching relPathname to subsurveys::storage-path & file-filter
// FIXME resolve subsurveyId by matching relPathname to subsurveys::storage-path & file-filter
LOGGER
.
finer
(
"relPathname : "
+
relPathname
);
LOGGER
.
finer
(
"hdunum : "
+
String
.
valueOf
(
hdunum
));
LOGGER
.
finer
(
"subsurveyId : "
+
((
subsurveyId
==
null
)
?
"null"
:
this
.
subsurveyId
)
);
}
}
else
else
if
(
isDav
)
{
{
throw
new
IllegalArgumentException
(
"IVOID expected: ID must start with 'ivo://' but received: "
+
pubdid
);
LOGGER
.
finer
(
"isDav"
);
resolveDav
(
pubdid
);
}
}
}
else
if
(
isFile
)
private
void
resolveIvoid
(
String
pubdid
)
{
LOGGER
.
fine
(
"trace "
+
pubdid
);
int
qmarkIx
=
pubdid
.
lastIndexOf
(
"?"
);
int
dhashIx
=
pubdid
.
lastIndexOf
(
"#"
);
// returns -1 if hash not found
boolean
hash_not_found
=
(
dhashIx
<
0
);
if
(
hash_not_found
)
{
{
relPathname
=
pubdid
.
substring
(
qmarkIx
+
1
);
LOGGER
.
finer
(
"isFile"
);
hdunum
=
1
;
resolveFile
(
pubdid
)
;
}
}
else
else
{
{
relPathname
=
pubdid
.
substring
(
qmarkIx
+
1
,
dhashIx
);
throw
new
IllegalArgumentException
(
"IVOID expected: ID must start with 'ivo://' but received: "
+
pubdid
);
}
if
((
dhashIx
+
1
)
==
pubdid
.
length
())
throw
new
IllegalArgumentException
(
LOGGER
.
finer
(
"relPathname : "
+
relPathname
);
"if ID's last hash must be followed by HDU extension number however: "
+
pubdid
);
LOGGER
.
finer
(
"hdunum : "
+
String
.
valueOf
(
hdunum
));
else
LOGGER
.
finer
(
"subsurveyId : "
+
((
subsurveyId
==
null
)
?
"null"
:
this
.
subsurveyId
)
);
hdunum
=
1
+
Integer
.
parseInt
(
pubdid
.
substring
(
dhashIx
+
1
)
);
}
}
}
private
void
resolveIvoid
(
String
pubdid
)
{
LOGGER
.
fine
(
"trace "
+
pubdid
);
int
qmarkIx
=
pubdid
.
lastIndexOf
(
"?"
);
int
dhashIx
=
pubdid
.
lastIndexOf
(
"#"
);
// returns -1 if hash not found
boolean
hash_not_found
=
(
dhashIx
<
0
);
if
(
hash_not_found
)
{
relPathname
=
pubdid
.
substring
(
qmarkIx
+
1
);
hdunum
=
1
;
}
else
{
relPathname
=
pubdid
.
substring
(
qmarkIx
+
1
,
dhashIx
);
if
((
dhashIx
+
1
)
==
pubdid
.
length
())
throw
new
IllegalArgumentException
(
"if ID's last hash must be followed by HDU extension number however: "
+
pubdid
);
else
hdunum
=
1
+
Integer
.
parseInt
(
pubdid
.
substring
(
dhashIx
+
1
)
);
}
}
private
void
resolveDav
(
String
pubdid
)
{
LOGGER
.
fine
(
"trace "
+
pubdid
);
int
dhashIx
=
pubdid
.
lastIndexOf
(
"#"
);
// returns -1 if hash not found
boolean
hash_not_found
=
(
dhashIx
<
0
);
if
(
hash_not_found
)
{
relPathname
=
pubdid
;
hdunum
=
1
;
}
else
{
relPathname
=
pubdid
.
substring
(
0
,
dhashIx
);
if
((
dhashIx
+
1
)
==
pubdid
.
length
())
throw
new
IllegalArgumentException
(
"if ID's last hash must be followed by HDU extension number however: "
+
pubdid
);
else
hdunum
=
1
+
Integer
.
parseInt
(
pubdid
.
substring
(
dhashIx
+
1
)
);
}
}
private
void
resolveFile
(
String
pubdid
)
{
LOGGER
.
fine
(
"trace "
+
pubdid
);
int
slashIx
=
pubdid
.
indexOf
(
"/"
);
// first slash in ://
int
dhashIx
=
pubdid
.
lastIndexOf
(
"#"
);
// returns -1 if hash not found
boolean
hash_not_found
=
(
dhashIx
<
0
);
if
(
hash_not_found
)
{
relPathname
=
pubdid
.
substring
(
slashIx
+
2
,
dhashIx
);
hdunum
=
1
;
}
else
{
relPathname
=
pubdid
.
substring
(
slashIx
+
2
,
dhashIx
);
if
((
dhashIx
+
1
)
==
pubdid
.
length
())
throw
new
IllegalArgumentException
(
"if ID's last hash must be followed by HDU extension number however: "
+
pubdid
);
else
hdunum
=
1
+
Integer
.
parseInt
(
pubdid
.
substring
(
dhashIx
+
1
)
);
}
}
}
}
This diff is collapsed.
Click to expand it.
data-access/servlet/src/main/java/cutout/SodaImpl.java
+
8
−
2
View file @
f67a5012
...
@@ -55,7 +55,13 @@ class SodaImpl implements Soda
...
@@ -55,7 +55,13 @@ class SodaImpl implements Soda
boolean
pixels_valid
=
(
pixels
!=
null
);
boolean
pixels_valid
=
(
pixels
!=
null
);
String
boundsString
=
""
;
String
boundsString
=
""
;
String
absPathname
=
fitsPaths
.
surveys
()
+
"/"
+
relPathname
;
final
boolean
isDavCall
=
relPathname
.
startsWith
(
"http://"
)
||
relPathname
.
startsWith
(
"https://"
);
final
boolean
isAbsPath
=
relPathname
.
startsWith
(
"/"
);
// Resolver removes schema from file://
// file:///some_abs_path -> /soma_abs_path
// file://some_rel_path -> some_rel_path
String
absPathname
=
(
isDavCall
||
isAbsPath
)
?
relPathname
:
(
fitsPaths
.
surveys
()
+
"/"
+
relPathname
);
if
(
!
pixels_valid
)
if
(
!
pixels_valid
)
{
{
...
@@ -116,7 +122,7 @@ class SodaImpl implements Soda
...
@@ -116,7 +122,7 @@ class SodaImpl implements Soda
String
[]
cmdCut
=
new
String
[
5
];
String
[]
cmdCut
=
new
String
[
5
];
cmdCut
[
0
]
=
"/usr/local/bin/vlkb"
;
cmdCut
[
0
]
=
"/usr/local/bin/vlkb"
;
cmdCut
[
1
]
=
"imcopy"
;
cmdCut
[
1
]
=
isDavCall
?
"imcopydav"
:
"imcopy"
;
cmdCut
[
2
]
=
absPathname
;
cmdCut
[
2
]
=
absPathname
;
cmdCut
[
3
]
=
String
.
valueOf
(
hdunum
-
1
);
cmdCut
[
3
]
=
String
.
valueOf
(
hdunum
-
1
);
cmdCut
[
4
]
=
pixFilterString
;
cmdCut
[
4
]
=
pixFilterString
;
...
...
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