Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
e60eed83
Commit
e60eed83
authored
8 years ago
by
gakin
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-4338: Introduce do-not-create-original-dir flag to DefaultStorageProcessor
SVN: 37283
parent
7c1e1bff
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
datastore_server/source/java/ch/systemsx/cisd/etlserver/DefaultStorageProcessor.java
+21
-6
21 additions, 6 deletions
...a/ch/systemsx/cisd/etlserver/DefaultStorageProcessor.java
with
21 additions
and
6 deletions
datastore_server/source/java/ch/systemsx/cisd/etlserver/DefaultStorageProcessor.java
+
21
−
6
View file @
e60eed83
...
...
@@ -50,6 +50,10 @@ public class DefaultStorageProcessor extends AbstractStorageProcessor implements
static
final
String
DELETE_UNZIPPED_KEY
=
"delete_unzipped"
;
// the following flag is introduced to be used in cases like openbis sync where we download the data set files including the 'original' folder
// and then move all of them to the data store. This way, the thumbnail archives in screening instances will also be handled.
static
final
String
DO_NOT_CREATE_ORIGINAL_DIR_KEY
=
"do-not-create-original-dir"
;
private
static
final
Logger
operationLog
=
LogFactory
.
getLogger
(
LogCategory
.
OPERATION
,
DefaultStorageProcessor
.
class
);
...
...
@@ -57,12 +61,15 @@ public class DefaultStorageProcessor extends AbstractStorageProcessor implements
private
final
boolean
deleteUnzipped
;
private
final
boolean
doNotCreateOriginalDir
;
public
DefaultStorageProcessor
(
final
Properties
properties
)
{
super
(
properties
);
unzip
=
PropertyUtils
.
getBoolean
(
properties
,
UNZIP_CRITERIA_KEY
,
false
);
deleteUnzipped
=
PropertyUtils
.
getBoolean
(
properties
,
DELETE_UNZIPPED_KEY
,
true
);
doNotCreateOriginalDir
=
PropertyUtils
.
getBoolean
(
properties
,
DO_NOT_CREATE_ORIGINAL_DIR_KEY
,
false
);
}
//
...
...
@@ -88,6 +95,8 @@ public class DefaultStorageProcessor extends AbstractStorageProcessor implements
protected
final
UnstoreDataAction
unstoreDataAction
;
private
final
boolean
doNotCreateOriginalDir
;
public
DefaultStorageProcessorTransaction
(
StorageProcessorTransactionParameters
parameters
,
DefaultStorageProcessor
processor
)
{
...
...
@@ -95,19 +104,25 @@ public class DefaultStorageProcessor extends AbstractStorageProcessor implements
this
.
unzip
=
processor
.
unzip
;
this
.
deleteUnzipped
=
processor
.
deleteUnzipped
;
this
.
unstoreDataAction
=
processor
.
getDefaultUnstoreDataAction
(
null
);
this
.
doNotCreateOriginalDir
=
processor
.
doNotCreateOriginalDir
;
}
@Override
protected
File
executeStoreData
(
ITypeExtractor
typeExtractor
,
IMailClient
mailClient
)
{
checkParameters
(
incomingDataSetDirectory
,
rootDirectory
);
File
originalDir
=
getOriginalDirectory
(
rootDirectory
)
;
if
(
o
riginalDir
.
mkdir
()
==
false
)
File
targetDir
=
rootDirectory
;
if
(
doNotCreateO
riginalDir
==
false
)
{
throw
new
EnvironmentFailureException
(
"Couldn't create "
+
originalDir
.
getAbsolutePath
());
File
originalDir
=
getOriginalDirectory
(
rootDirectory
);
if
(
originalDir
.
mkdir
()
==
false
)
{
throw
new
EnvironmentFailureException
(
"Couldn't create "
+
originalDir
.
getAbsolutePath
());
}
targetDir
=
originalDir
;
}
final
File
targetFile
=
new
File
(
original
Dir
,
incomingDataSetDirectory
.
getName
());
final
File
targetFile
=
new
File
(
target
Dir
,
incomingDataSetDirectory
.
getName
());
if
(
FileRenamer
.
renameAndLog
(
incomingDataSetDirectory
,
targetFile
)
==
false
)
{
throw
new
EnvironmentFailureException
(
String
.
format
(
NO_RENAME
,
...
...
@@ -116,7 +131,7 @@ public class DefaultStorageProcessor extends AbstractStorageProcessor implements
// Set the stored data directory in case unzip throws an exception.
this
.
storedDataDirectory
=
rootDirectory
;
unzipIfMatching
(
targetFile
,
original
Dir
);
unzipIfMatching
(
targetFile
,
target
Dir
);
return
rootDirectory
;
}
...
...
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