Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mediaconch_plugin4rosetta
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
Container registry
Harbor Registry
Model registry
Operate
Environments
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
Digital Preservation
mediaconch_plugin4rosetta
Commits
0a99f1a2
Commit
0a99f1a2
authored
2 years ago
by
Andreas Romeyke
Browse files
Options
Downloads
Patches
Plain Diff
- readded logger
- removed getAgentName() - minor fixes
parent
532e99ae
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
java/org/slub/rosetta/dps/repository/plugin/SLUBMatroskaFFV1FormatValidationPlugin.java
+12
-19
12 additions, 19 deletions
...sitory/plugin/SLUBMatroskaFFV1FormatValidationPlugin.java
with
12 additions
and
19 deletions
java/org/slub/rosetta/dps/repository/plugin/SLUBMatroskaFFV1FormatValidationPlugin.java
+
12
−
19
View file @
0a99f1a2
...
@@ -16,7 +16,9 @@ limitations under the License.
...
@@ -16,7 +16,9 @@ limitations under the License.
package
org.slub.rosetta.dps.repository.plugin
;
package
org.slub.rosetta.dps.repository.plugin
;
import
com.exlibris.core.infra.common.exceptions.logging.ExLogger
;
import
com.exlibris.dps.sdk.techmd.FormatValidationPlugin
;
import
com.exlibris.dps.sdk.techmd.FormatValidationPlugin
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -31,12 +33,13 @@ import java.util.List;
...
@@ -31,12 +33,13 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
* SLUB
TechnicalMetadataExtractorMediaConch
Plugin
* SLUB
MatroskaFFV1FormatValidation
Plugin
*
*
* @author andreas.romeyke@slub-dresden.de (Andreas Romeyke)
* @author andreas.romeyke@slub-dresden.de (Andreas Romeyke)
* @see com.exlibris.dps.sdk.techmd.FormatValidationPlugin
* @see com.exlibris.dps.sdk.techmd.FormatValidationPlugin
*/
*/
public
class
SLUBMatroskaFFV1FormatValidationPlugin
implements
FormatValidationPlugin
{
public
class
SLUBMatroskaFFV1FormatValidationPlugin
implements
FormatValidationPlugin
{
private
static
final
ExLogger
log
=
ExLogger
.
getExLogger
(
SLUBMatroskaFFV1FormatValidationPlugin
.
class
);
private
String
mediaconch_binary_path
;
private
String
mediaconch_binary_path
;
private
String
mediaconch_current_profile_path
;
private
String
mediaconch_current_profile_path
;
private
String
mediaconch_upcoming_profile_path
;
private
String
mediaconch_upcoming_profile_path
;
...
@@ -50,8 +53,7 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
...
@@ -50,8 +53,7 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
/** constructor */
/** constructor */
public
SLUBMatroskaFFV1FormatValidationPlugin
()
{
public
SLUBMatroskaFFV1FormatValidationPlugin
()
{
//log.info("SLUBVirusCheckPlugin instantiated with host=" + host + " port=" + port + " timeout=" + timeout);
log
.
info
(
"SLUBTechnicalMetadataExtractorMediaConchPlugin instantiated"
);
System
.
out
.
println
(
"SLUBTechnicalMetadataExtractorMediaConchPlugin instantiated"
);
}
}
/** init params to configure the plugin via xml forms
/** init params to configure the plugin via xml forms
...
@@ -77,11 +79,12 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
...
@@ -77,11 +79,12 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
// TODO: log.info();
}
}
@Override
@Override
// TODO: Pfadstring, Prüfsumme, modification date für beide Profile
// TODO: Pfadstring, Prüfsumme, modification date für beide Profile
public
String
getProfile
()
{
public
final
String
getProfile
()
{
String
modified_current
=
modificationDateOfFile
(
this
.
mediaconch_current_profile_path
);
String
modified_current
=
modificationDateOfFile
(
this
.
mediaconch_current_profile_path
);
String
modified_upcoming
=
modificationDateOfFile
(
this
.
mediaconch_upcoming_profile_path
);
String
modified_upcoming
=
modificationDateOfFile
(
this
.
mediaconch_upcoming_profile_path
);
/* there is no documentation in ExL API, therefore we use it to document the profile versions in a light way */
/* there is no documentation in ExL API, therefore we use it to document the profile versions in a light way */
...
@@ -131,11 +134,6 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
...
@@ -131,11 +134,6 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
}
}
}
}
public
String
getAgentName
()
{
return
"mediaconch"
;
}
@Override
@Override
public
boolean
validateFormat
(
String
filePath
)
{
public
boolean
validateFormat
(
String
filePath
)
{
// mediaconch validation, first using upcoming profile, if invalid then retry with current profile
// mediaconch validation, first using upcoming profile, if invalid then retry with current profile
...
@@ -151,7 +149,7 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
...
@@ -151,7 +149,7 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
*
*
* @return string with version and signature version
* @return string with version and signature version
*/
*/
public
String
getAgent
()
{
public
final
String
getAgent
()
{
StringBuilder
response
=
new
StringBuilder
();
StringBuilder
response
=
new
StringBuilder
();
response
.
append
(
"mediaconch:\n"
);
response
.
append
(
"mediaconch:\n"
);
InputStreamReader
process_out
=
null
;
InputStreamReader
process_out
=
null
;
...
@@ -190,17 +188,17 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
...
@@ -190,17 +188,17 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
}
}
@Override
@Override
public
boolean
isWellFormed
()
{
public
final
boolean
isWellFormed
()
{
return
this
.
iswellformed
;
return
this
.
iswellformed
;
}
}
@Override
@Override
public
List
<
String
>
getErrors
()
{
public
final
List
<
String
>
getErrors
()
{
return
List
.
copyOf
(
this
.
validationLog
);
return
List
.
copyOf
(
this
.
validationLog
);
}
}
@Override
@Override
public
boolean
isValid
()
{
public
final
boolean
isValid
()
{
//System.out.println("DEBUG: is valid=" + this.isvalid);
//System.out.println("DEBUG: is valid=" + this.isvalid);
return
this
.
isvalid
;
return
this
.
isvalid
;
}
}
...
@@ -218,8 +216,7 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
...
@@ -218,8 +216,7 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
byte
[]
b
=
Files
.
readAllBytes
(
Paths
.
get
(
filename
));
byte
[]
b
=
Files
.
readAllBytes
(
Paths
.
get
(
filename
));
byte
[]
digest
=
md
.
digest
(
b
);
byte
[]
digest
=
md
.
digest
(
b
);
String
hexdigest
=
new
BigInteger
(
1
,
digest
).
toString
(
16
);
return
new
BigInteger
(
1
,
digest
).
toString
(
16
);
return
hexdigest
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -244,7 +241,6 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
...
@@ -244,7 +241,6 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
initp
.
put
(
"mediaconch_binary_path"
,
"/usr/bin/mediaconch"
);
initp
.
put
(
"mediaconch_binary_path"
,
"/usr/bin/mediaconch"
);
initp
.
put
(
"mediaconch_current_profile_path"
,
"/etc/mediaconch/profile.xml"
);
initp
.
put
(
"mediaconch_current_profile_path"
,
"/etc/mediaconch/profile.xml"
);
initp
.
put
(
"mediaconch_upcoming_profile_path"
,
"/etc/mediaconch/profile.xml"
);
initp
.
put
(
"mediaconch_upcoming_profile_path"
,
"/etc/mediaconch/profile.xml"
);
initp
.
put
(
"mediainfo_binary_path"
,
"/usr/bin/mediainfo"
);
plugin
.
initParams
(
initp
);
plugin
.
initParams
(
initp
);
System
.
out
.
println
(
"----------------------------------"
);
System
.
out
.
println
(
"----------------------------------"
);
System
.
out
.
println
(
"Agent: '"
+
plugin
.
getAgent
()
+
"'"
);
System
.
out
.
println
(
"Agent: '"
+
plugin
.
getAgent
()
+
"'"
);
...
@@ -253,9 +249,6 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
...
@@ -253,9 +249,6 @@ public class SLUBMatroskaFFV1FormatValidationPlugin implements FormatValidationP
System
.
out
.
println
(
"Validation RESULT: "
+
plugin
.
isValid
());
System
.
out
.
println
(
"Validation RESULT: "
+
plugin
.
isValid
());
}
}
System
.
out
.
println
(
"----------------------------------"
);
System
.
out
.
println
(
"----------------------------------"
);
System
.
out
.
println
(
"getAgentName:"
);
System
.
out
.
println
(
plugin
.
getAgentName
());
System
.
out
.
println
(
"----------------------------------"
);
System
.
out
.
println
(
"getAgent:"
);
System
.
out
.
println
(
"getAgent:"
);
System
.
out
.
println
(
plugin
.
getAgent
());
System
.
out
.
println
(
plugin
.
getAgent
());
System
.
out
.
println
(
"----------------------------------"
);
System
.
out
.
println
(
"----------------------------------"
);
...
...
This diff is collapsed.
Click to expand it.
Andreas Romeyke
@romeyke
mentioned in issue
#4 (closed)
·
2 years ago
mentioned in issue
#4 (closed)
mentioned in issue #4
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