Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
Import Process
Fedora Ingest Service
Commits
7c0ae8a5
Commit
7c0ae8a5
authored
Sep 30, 2020
by
Thomas Bernhart
Browse files
MEMO-733: Remove try-catch blocks from Ingester
parent
5ada2f49
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/kotlin/Ingester.kt
View file @
7c0ae8a5
...
...
@@ -76,15 +76,10 @@ class Ingester(
instantiations
.
forEach
{
instantiationPair
->
val
instantiationOutput
=
StringWriter
()
instantiationPair
.
second
.
write
(
instantiationOutput
,
"NTRIPLES"
)
try
{
val
instantiationData
=
instantiationOutput
.
toString
()
log
.
info
(
"Ingesting instantiation ${instantiationPair.first}."
)
transaction
.
createOrUpdateRdfResource
(
URI
(
instantiationPair
.
first
),
instantiationData
,
RdfContentTypes
.
NTRIPLES
)
log
.
info
(
"Ingested instantiation ${instantiationPair.first}."
)
}
catch
(
ex
:
FcrepoOperationFailedException
)
{
log
.
error
(
"Ingestion of instantiation ${instantiationPair.first} failed: ${ex.localizedMessage}."
)
throw
ex
}
val
instantiationData
=
instantiationOutput
.
toString
()
log
.
info
(
"Ingesting instantiation ${instantiationPair.first}."
)
transaction
.
createOrUpdateRdfResource
(
URI
(
instantiationPair
.
first
),
instantiationData
,
RdfContentTypes
.
NTRIPLES
)
log
.
info
(
"Ingested instantiation ${instantiationPair.first}."
)
}
}
...
...
@@ -97,16 +92,11 @@ class Ingester(
if
(
path
!=
null
)
{
sftpClient
.
open
(
File
(
path
)).
use
{
stream
->
val
binaryUri
=
"${it.first}/binary"
try
{
val
mimeType
=
rdfHandler
.
getMimeType
().
first
{
mT
->
mT
.
first
==
digitalInstantiationUrl
}.
second
log
.
info
(
"Ingesting binary $binaryUri with mime type $mimeType."
)
transaction
.
createOrUpdateBinaryResource
(
URI
(
binaryUri
),
stream
,
mimeType
)
}
catch
(
ex
:
FcrepoOperationFailedException
)
{
log
.
error
(
"Ingestion of binary $binaryUri failed: ${ex.localizedMessage}."
)
throw
ex
}
val
mimeType
=
rdfHandler
.
getMimeType
().
first
{
mT
->
mT
.
first
==
digitalInstantiationUrl
}.
second
log
.
info
(
"Ingesting binary $binaryUri with mime type $mimeType."
)
transaction
.
createOrUpdateBinaryResource
(
URI
(
binaryUri
),
stream
,
mimeType
)
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment