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
29fbbb1e
Commit
29fbbb1e
authored
3 months ago
by
Robert Butora
Browse files
Options
Downloads
Patches
Plain Diff
mcutout: refactors results/Report publishing func
parent
7cd1d0a3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
data-access/servlet/src/main/java/mcutout/webapi/UWSMCutoutWork.java
+23
-33
23 additions, 33 deletions
.../servlet/src/main/java/mcutout/webapi/UWSMCutoutWork.java
with
23 additions
and
33 deletions
data-access/servlet/src/main/java/mcutout/webapi/UWSMCutoutWork.java
+
23
−
33
View file @
29fbbb1e
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.PrintWriter
;
import
java.io.OutputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.OutputStreamWriter
;
import
java.io.IOException
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
uws.UWSException
;
...
...
@@ -55,7 +56,6 @@ public class UWSMCutoutWork extends JobThread
}
@Override
protected
void
jobWork
()
throws
UWSException
,
InterruptedException
{
...
...
@@ -83,36 +83,8 @@ public class UWSMCutoutWork extends JobThread
logger
.
logThread
(
LogLevel
.
INFO
,
this
,
"Prepare Result"
,
" job:requestUrl: "
+
job
.
getUrl
().
getRequestURL
(),
null
);
// publish Report
Result
resultRes
=
new
Result
(
"Report"
,
"none"
,
null
,
false
);
resultRes
.
setMimeType
(
"application/json"
);
OutputStream
respResOutputStream
=
getResultOutput
(
resultRes
);
String
absResPathname
=
mresult
.
resJsonPathname
;
File
downloadResFile
=
new
File
(
absResPathname
);
FileInputStream
fileResInput
=
new
FileInputStream
(
downloadResFile
);
fileResInput
.
transferTo
(
respResOutputStream
);
publishResult
(
resultRes
);
downloadResFile
.
delete
();
// publish mcutout.tar.gz
final
String
id
=
"mcutout.tar.gz"
;
Result
result
=
new
Result
(
id
,
"none"
,
null
,
false
);
result
.
setMimeType
(
"application/gzip"
);
OutputStream
respOutputStream
=
getResultOutput
(
result
);
String
absCutPathname
=
mresult
.
fileName
;
File
downloadFile
=
new
File
(
absCutPathname
);
FileInputStream
fileInput
=
new
FileInputStream
(
downloadFile
);
fileInput
.
transferTo
(
respOutputStream
);
publishResult
(
result
);
downloadFile
.
delete
();
publishOnEndpoint
(
"Report"
,
"application/json"
,
mresult
.
resJsonPathname
);
publishOnEndpoint
(
"mcutout.tar.gz"
,
"application/gzip"
,
mresult
.
fileName
);
// delete cut-files (were published/copied to uws-file store)
...
...
@@ -129,4 +101,22 @@ public class UWSMCutoutWork extends JobThread
}
}
private
void
publishOnEndpoint
(
String
epName
,
String
mimeType
,
String
absPathname
)
throws
FileNotFoundException
,
IOException
,
UWSException
{
Result
result
=
new
Result
(
epName
,
"none"
,
null
,
false
);
result
.
setMimeType
(
mimeType
);
File
downloadFile
=
new
File
(
absPathname
);
FileInputStream
fileInput
=
new
FileInputStream
(
downloadFile
);
OutputStream
resOutputStream
=
getResultOutput
(
result
);
fileInput
.
transferTo
(
resOutputStream
);
publishResult
(
result
);
downloadFile
.
delete
();
}
}
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