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
69352bc5
Commit
69352bc5
authored
14 years ago
by
cramakri
Browse files
Options
Downloads
Patches
Plain Diff
LMS-1584 Made ChainedDataSetMigrationTask more robust.
SVN: 16683
parent
5223e422
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/plugins/ChainedDataSetMigrationTask.java
+27
-10
27 additions, 10 deletions
...x/cisd/etlserver/plugins/ChainedDataSetMigrationTask.java
with
27 additions
and
10 deletions
datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/ChainedDataSetMigrationTask.java
+
27
−
10
View file @
69352bc5
...
@@ -36,20 +36,23 @@ import ch.systemsx.cisd.etlserver.IMaintenanceTask;
...
@@ -36,20 +36,23 @@ import ch.systemsx.cisd.etlserver.IMaintenanceTask;
/**
/**
* Maintenance task migrating all data sets of a store by a chain of {@link IMigrator} instances.
* Maintenance task migrating all data sets of a store by a chain of {@link IMigrator} instances.
*
*
* @author Franz-Josef Elmer
* @author Franz-Josef Elmer
*/
*/
public
class
ChainedDataSetMigrationTask
implements
IMaintenanceTask
public
class
ChainedDataSetMigrationTask
implements
IMaintenanceTask
{
{
public
static
final
String
MIGRATORS_PROPERTY
=
"migrators"
;
public
static
final
String
MIGRATORS_PROPERTY
=
"migrators"
;
public
static
final
String
STORE_ROOT_PROPERTY
=
"storeRoot"
;
public
static
final
String
STORE_ROOT_PROPERTY
=
"storeRoot"
;
private
static
final
Pattern
UUID_PATTERN
=
Pattern
.
compile
(
"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
);
private
static
final
Pattern
UUID_PATTERN
=
Pattern
.
compile
(
"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
);
private
static
final
Logger
operationLog
=
private
static
final
Logger
operationLog
=
LogFactory
.
getLogger
(
LogCategory
.
OPERATION
,
ChainedDataSetMigrationTask
.
class
);
LogFactory
.
getLogger
(
LogCategory
.
OPERATION
,
ChainedDataSetMigrationTask
.
class
);
private
File
storeRoot
;
private
File
storeRoot
;
private
List
<
IMigrator
>
migrators
;
private
List
<
IMigrator
>
migrators
;
public
void
setUp
(
String
pluginName
,
Properties
properties
)
public
void
setUp
(
String
pluginName
,
Properties
properties
)
...
@@ -62,7 +65,8 @@ public class ChainedDataSetMigrationTask implements IMaintenanceTask
...
@@ -62,7 +65,8 @@ public class ChainedDataSetMigrationTask implements IMaintenanceTask
+
" does not exist or is not a directory."
);
+
" does not exist or is not a directory."
);
}
}
SectionProperties
[]
sectionProperties
=
SectionProperties
[]
sectionProperties
=
PropertyParametersUtil
.
extractSectionProperties
(
properties
,
MIGRATORS_PROPERTY
,
false
);
PropertyParametersUtil
.
extractSectionProperties
(
properties
,
MIGRATORS_PROPERTY
,
false
);
migrators
=
new
ArrayList
<
IMigrator
>();
migrators
=
new
ArrayList
<
IMigrator
>();
for
(
SectionProperties
props
:
sectionProperties
)
for
(
SectionProperties
props
:
sectionProperties
)
{
{
...
@@ -86,7 +90,7 @@ public class ChainedDataSetMigrationTask implements IMaintenanceTask
...
@@ -86,7 +90,7 @@ public class ChainedDataSetMigrationTask implements IMaintenanceTask
operationLog
.
info
(
"Chain of migrators have been set up: "
+
builder
);
operationLog
.
info
(
"Chain of migrators have been set up: "
+
builder
);
}
}
}
}
public
void
execute
()
public
void
execute
()
{
{
File
[]
files
=
storeRoot
.
listFiles
(
new
FileFilter
()
File
[]
files
=
storeRoot
.
listFiles
(
new
FileFilter
()
...
@@ -113,17 +117,30 @@ public class ChainedDataSetMigrationTask implements IMaintenanceTask
...
@@ -113,17 +117,30 @@ public class ChainedDataSetMigrationTask implements IMaintenanceTask
}
}
}
}
}
}
private
boolean
migrate
(
File
dbInstanceDir
,
IMigrator
migrator
)
private
boolean
migrate
(
File
dbInstanceDir
,
IMigrator
migrator
)
{
{
List
<
File
>
migratedDataSets
=
new
ArrayList
<
File
>();
List
<
File
>
migratedDataSets
=
new
ArrayList
<
File
>();
List
<
File
>
failedDataSets
=
new
ArrayList
<
File
>();
List
<
File
>
failedDataSets
=
new
ArrayList
<
File
>();
for
(
File
l1
:
dbInstanceDir
.
listFiles
())
for
(
File
l1
:
dbInstanceDir
.
listFiles
())
{
{
// The OS may put files into these folders (e.g., .DS_Store)
if
(
false
==
l1
.
isDirectory
())
{
continue
;
}
for
(
File
l2
:
l1
.
listFiles
())
for
(
File
l2
:
l1
.
listFiles
())
{
{
if
(
false
==
l2
.
isDirectory
())
{
continue
;
}
for
(
File
l3
:
l2
.
listFiles
())
for
(
File
l3
:
l2
.
listFiles
())
{
{
if
(
false
==
l3
.
isDirectory
())
{
continue
;
}
for
(
File
dataset
:
l3
.
listFiles
())
for
(
File
dataset
:
l3
.
listFiles
())
{
{
boolean
success
=
migrator
.
migrate
(
dataset
);
boolean
success
=
migrator
.
migrate
(
dataset
);
...
...
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