Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tools for technical analysts
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
Harbor 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
Digital Preservation
tools for technical analysts
Commits
e46393ca
Commit
e46393ca
authored
2 years ago
by
Andreas Romeyke
Browse files
Options
Downloads
Patches
Plain Diff
- added get_ie_pid_by_sip()
- improved output
parent
1155465a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SLUB/LZA/Rosetta/TA.pm
+57
-1
57 additions, 1 deletion
lib/SLUB/LZA/Rosetta/TA.pm
with
57 additions
and
1 deletion
lib/SLUB/LZA/Rosetta/TA.pm
+
57
−
1
View file @
e46393ca
...
@@ -5,6 +5,7 @@ use App::Cmd::Setup -app;
...
@@ -5,6 +5,7 @@ use App::Cmd::Setup -app;
use
Path::
Tiny
qw( path )
;
use
Path::
Tiny
qw( path )
;
use
YAML
qw(LoadFile)
;
use
YAML
qw(LoadFile)
;
use
LWP::
UserAgent
;
use
LWP::
UserAgent
;
use
SOAP::
Lite
;
use
Carp
qw( croak )
;
use
Carp
qw( croak )
;
use
feature
qw(say)
;
use
feature
qw(say)
;
use
Regexp::
Optimizer
;
use
Regexp::
Optimizer
;
...
@@ -76,6 +77,45 @@ sub sru_search {
...
@@ -76,6 +77,45 @@ sub sru_search {
}
}
}
}
sub
get_ie_pid_by_sip
{
my
$sip
=
shift
;
my
$protocol
=
"
https
";
my
$host
=
$config
{
host
};
my
$port
=
8443
;
my
$wsdl_url
=
"
${protocol}
://
${host}
:
${port}
/dpsws/repository/SipWebServices?wsdl
";
#print "DEBUG: $wsdl_url";
my
$soap
=
SOAP::
Lite
->
new
;
$soap
->
proxy
(
$wsdl_url
,
timeout
=>
3000
,
keep_alive
=>
1
,
ssl_opts
=>
{
verify_hostname
=>
1
,
# SSL_ca_path => '/etc/ssl/',
}
);
$soap
->
ns
('
http://dps.exlibris.com/
');
$soap
->
on_action
(
sub
{
return
''});
# remove SOAP action if used with Rosetta 6.xx or higher
my
$som
=
$soap
->
call
(
'
getSipIEs
',
SOAP::
Data
->
name
('
arg0
')
->
value
(
$sip
)
->
type
('
string
')
);
if
(
$som
->
fault
)
{
confess
("
ERROR: server '
$host
' says:
"
.
$som
->
faultstring
.
"
\n
");
}
#my $res = log_empty_result( $som, $logger, $host);
my
$res
=
$som
->
result
;
if
(
$res
eq
'')
{
# defined but empty result without SOAP fault
# HINT: 2 possibilities
# * SIP-ID doesn't exist
# * SIP-ID existed before but Rosetta clean up job removed all status infos
return
;
# let caller decide how to act on an empty result (no SOAP error)
}
my
$ie
=
$res
;
$ie
=~
s/^IE(\d*).*/$1/
;
return
$ie
;
}
{
{
my
$bred
=
"
\e
[1;31m
";
my
$bred
=
"
\e
[1;31m
";
my
$red
=
"
\e
[31m
";
my
$red
=
"
\e
[31m
";
...
@@ -206,12 +246,16 @@ sub trace_log {
...
@@ -206,12 +246,16 @@ sub trace_log {
my
$line_rx3
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*Loaded \d+ files for: .*$searchid}
);
my
$line_rx3
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*Loaded \d+ files for: .*$searchid}
);
my
$line_rx4
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*((Representation $searchid IE \d+)|(Representation \d+ IE $searchid)) Copy ID: \d+}
);
my
$line_rx4
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*((Representation $searchid IE \d+)|(Representation \d+ IE $searchid)) Copy ID: \d+}
);
if
(
$with_trace
=~
m/^SIP/
)
{
# search specific sip
if
(
$with_trace
=~
m/^SIP/
)
{
# search specific sip
$sip_id
=
$searchid
;
$ie_pid
=
get_ie_pid_by_sip
(
$sip_id
);
$line_rx1
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*($sip_rx)$searchid}
);
$line_rx1
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*($sip_rx)$searchid}
);
$line_rx2
=
$line_rx1
;
$line_rx2
=
$line_rx1
;
}
elsif
(
$with_trace
=~
m/^IE/
)
{
# search specific IE
}
elsif
(
$with_trace
=~
m/^IE/
)
{
# search specific IE
$ie_pid
=
$searchid
;
$line_rx3
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*Loaded \d+ files for: REP\d+ \(IE$searchid\)}
);
$line_rx3
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*Loaded \d+ files for: REP\d+ \(IE$searchid\)}
);
$line_rx4
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*Representation \d+ IE $searchid Copy ID: \d+}
);
$line_rx4
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*Representation \d+ IE $searchid Copy ID: \d+}
);
}
elsif
(
$with_trace
=~
m/^REP/
)
{
}
elsif
(
$with_trace
=~
m/^REP/
)
{
$rep_id
=
$searchid
;
$line_rx3
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*Loaded \d+ files for: REP$searchid \(IE\d+\)}
);
$line_rx3
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*Loaded \d+ files for: REP$searchid \(IE\d+\)}
);
$line_rx4
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*Representation $searchid IE \d+ Copy ID: \d+}
);
$line_rx4
=
Regexp::
Optimizer
->
new
->
optimize
(
qr{^$pre_rx.*Representation $searchid IE \d+ Copy ID: \d+}
);
}
}
...
@@ -251,6 +295,9 @@ sub trace_log {
...
@@ -251,6 +295,9 @@ sub trace_log {
if
(
m/$line_rx1/
)
{
if
(
m/$line_rx1/
)
{
if
(
!
defined
$sip_id
and
m/$sip_rx(\d{6}),/
)
{
if
(
!
defined
$sip_id
and
m/$sip_rx(\d{6}),/
)
{
$sip_id
=
$
2
;
$sip_id
=
$
2
;
if
(
!
defined
$ie_pid
)
{
$ie_pid
=
get_ie_pid_by_sip
(
$sip_id
);
}
$cache
{
$file_md5
}
->
{
sip_id
}
->
{
$sip_id
}
=
1
;
# mark as match
$cache
{
$file_md5
}
->
{
sip_id
}
->
{
$sip_id
}
=
1
;
# mark as match
}
}
if
(
!
defined
$deposit_dir
and
m/originalDirName=([^,]*),/
)
{
if
(
!
defined
$deposit_dir
and
m/originalDirName=([^,]*),/
)
{
...
@@ -265,6 +312,9 @@ sub trace_log {
...
@@ -265,6 +312,9 @@ sub trace_log {
}
elsif
(
m/$line_rx2/
)
{
}
elsif
(
m/$line_rx2/
)
{
if
(
!
defined
$sip_id
and
m/SIP (\d{6})/
)
{
if
(
!
defined
$sip_id
and
m/SIP (\d{6})/
)
{
$sip_id
=
$
1
;
$sip_id
=
$
1
;
if
(
!
defined
$ie_pid
)
{
$ie_pid
=
get_ie_pid_by_sip
(
$sip_id
);
}
$cache
{
$file_md5
}
->
{
sip_id
}
->
{
$sip_id
}
=
1
;
# mark as match
$cache
{
$file_md5
}
->
{
sip_id
}
->
{
$sip_id
}
=
1
;
# mark as match
}
}
if
(
!
defined
$deposit_id
and
m/Deposit Activity ID=(\d+)/
)
{
if
(
!
defined
$deposit_id
and
m/Deposit Activity ID=(\d+)/
)
{
...
@@ -296,7 +346,13 @@ sub trace_log {
...
@@ -296,7 +346,13 @@ sub trace_log {
};
};
helper_scan_log
(
$directory
,
$fh_processing_stage1
);
helper_scan_log
(
$directory
,
$fh_processing_stage1
);
no
warnings
;
no
warnings
;
my
$match
=
"
found: DIR=
$deposit_dir
, DEPOSITID=
$deposit_id
, SIPID=
$sip_id
, IEPID=
$ie_pid
, REPID=
$rep_id
";
my
$match
=
sprintf
("
found: DIR=%s, DEPOSITID=%d, SIPID=%s, IEPID=%s, REPID=%s
",
$deposit_dir
?
$deposit_dir
:
"
----
",
$deposit_id
?
$deposit_id
:
"
----
",
$sip_id
?
$sip_id
:
"
----
",
$ie_pid
?
"
IE
"
.
$ie_pid
:
"
----
",
$rep_id
?
"
REP
"
.
$rep_id:
"
----
"
);
use
warnings
;
use
warnings
;
say
"
$match
";
say
"
$match
";
say
"
-
"
x
(
length
(
$match
));
say
"
-
"
x
(
length
(
$match
));
...
...
This diff is collapsed.
Click to expand it.
Andreas Romeyke
@romeyke
mentioned in issue
#1 (closed)
·
2 years ago
mentioned in issue
#1 (closed)
mentioned in issue #1
Toggle commit list
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