Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DARIAH-DE Aggregator Services
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
DARIAH-DE
DARIAH-DE Aggregator Services
Commits
cbadb7e2
Commit
cbadb7e2
authored
10 years ago
by
Thorsten Vitt
Browse files
Options
Downloads
Patches
Plain Diff
Support for leaving out meta and aggregation files
parent
993cd116
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
src/main/java/info/textgrid/services/aggregator/REST.java
+1
-1
1 addition, 1 deletion
src/main/java/info/textgrid/services/aggregator/REST.java
src/main/java/info/textgrid/services/aggregator/zip/ZipResult.java
+9
-2
9 additions, 2 deletions
...java/info/textgrid/services/aggregator/zip/ZipResult.java
with
10 additions
and
3 deletions
src/main/java/info/textgrid/services/aggregator/REST.java
+
1
−
1
View file @
cbadb7e2
...
@@ -162,7 +162,7 @@ public Response getZIP(
...
@@ -162,7 +162,7 @@ public Response getZIP(
@Context
final
Request
request
)
throws
MetadataParseFault
,
ObjectNotFoundFault
,
IoFault
,
AuthFault
,
ProtocolNotImplementedFault
,
IOException
,
SaxonApiException
{
@Context
final
Request
request
)
throws
MetadataParseFault
,
ObjectNotFoundFault
,
IoFault
,
AuthFault
,
ProtocolNotImplementedFault
,
IOException
,
SaxonApiException
{
final
ZipResult
zipResult
=
new
ZipResult
(
repository
,
request
,
uriList
,
filenames
,
metanames
,
dirnames
,
only
);
final
ZipResult
zipResult
=
new
ZipResult
(
repository
,
request
,
uriList
,
filenames
,
metanames
,
dirnames
,
only
,
meta
);
if
(
title
!=
null
)
if
(
title
!=
null
)
zipResult
.
setTitle
(
title
);
zipResult
.
setTitle
(
title
);
if
(
sid
!=
null
)
if
(
sid
!=
null
)
...
...
This diff is collapsed.
Click to expand it.
src/main/java/info/textgrid/services/aggregator/zip/ZipResult.java
+
9
−
2
View file @
cbadb7e2
...
@@ -60,6 +60,7 @@ public class ZipResult extends AbstractExporter implements StreamingOutput {
...
@@ -60,6 +60,7 @@ public class ZipResult extends AbstractExporter implements StreamingOutput {
private
final
Set
<
URI
>
written
=
Sets
.
newHashSet
();
private
final
Set
<
URI
>
written
=
Sets
.
newHashSet
();
private
boolean
onlySomeFormats
;
private
boolean
onlySomeFormats
;
private
List
<
MediaType
>
onlyFormats
;
private
List
<
MediaType
>
onlyFormats
;
private
boolean
includeMeta
;
private
static
final
Function
<
ObjectType
,
String
>
GetURI
=
new
Function
<
ObjectType
,
String
>()
{
private
static
final
Function
<
ObjectType
,
String
>
GetURI
=
new
Function
<
ObjectType
,
String
>()
{
...
@@ -74,7 +75,7 @@ public String apply(final ObjectType input) {
...
@@ -74,7 +75,7 @@ public String apply(final ObjectType input) {
public
ZipResult
(
final
ITextGridRep
repository
,
final
Request
request
,
public
ZipResult
(
final
ITextGridRep
repository
,
final
Request
request
,
final
String
uriList
,
final
String
filenames
,
final
String
uriList
,
final
String
filenames
,
final
String
metanames
,
final
String
dirnames
,
final
String
metanames
,
final
String
dirnames
,
final
List
<
String
>
only
)
{
final
List
<
String
>
only
,
final
boolean
includeMeta
)
{
super
(
repository
,
request
,
uriList
);
super
(
repository
,
request
,
uriList
);
final
ConfigurableFilenamePolicy
parentPolicy
=
ConfigurableFilenamePolicy
final
ConfigurableFilenamePolicy
parentPolicy
=
ConfigurableFilenamePolicy
.
builder
(
dirnames
)
.
builder
(
dirnames
)
...
@@ -104,6 +105,7 @@ public MediaType apply(final String input) {
...
@@ -104,6 +105,7 @@ public MediaType apply(final String input) {
setFileExtension
(
"zip"
);
setFileExtension
(
"zip"
);
setMediaType
(
"application/zip"
);
setMediaType
(
"application/zip"
);
this
.
includeMeta
=
includeMeta
;
}
}
@Override
@Override
...
@@ -245,7 +247,8 @@ private void writeAggregation(final ZipOutputStream zip,
...
@@ -245,7 +247,8 @@ private void writeAggregation(final ZipOutputStream zip,
logger
.
log
(
Level
.
WARNING
,
"Skipping duplicate aggregation {0}"
,
uri
);
logger
.
log
(
Level
.
WARNING
,
"Skipping duplicate aggregation {0}"
,
uri
);
return
;
return
;
}
}
writeFile
(
zip
,
root
);
if
(
includeMeta
)
writeFile
(
zip
,
root
);
// final ZipEntry zipEntry = new ZipEntry(policy.getFilename(root, true)
// final ZipEntry zipEntry = new ZipEntry(policy.getFilename(root, true)
// .toString());
// .toString());
// zip.putNextEntry(zipEntry);
// zip.putNextEntry(zipEntry);
...
@@ -323,6 +326,10 @@ private void writeFile(final ZipOutputStream zip,
...
@@ -323,6 +326,10 @@ private void writeFile(final ZipOutputStream zip,
private
void
writeMetadata
(
final
ZipOutputStream
zip
,
private
void
writeMetadata
(
final
ZipOutputStream
zip
,
final
IAggregationEntry
child
)
throws
IOException
{
final
IAggregationEntry
child
)
throws
IOException
{
if
(!
includeMeta
)
return
;
final
ZipEntry
zipEntry
=
new
ZipEntry
(
metaPolicy
.
getFilename
(
child
).
toString
());
final
ZipEntry
zipEntry
=
new
ZipEntry
(
metaPolicy
.
getFilename
(
child
).
toString
());
zipEntry
.
setTime
(
child
.
getMetadata
().
getGeneric
().
getGenerated
()
zipEntry
.
setTime
(
child
.
getMetadata
().
getGeneric
().
getGenerated
()
.
getLastModified
().
toGregorianCalendar
().
getTimeInMillis
());
.
getLastModified
().
toGregorianCalendar
().
getTimeInMillis
());
...
...
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