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
7764a8cd
Commit
7764a8cd
authored
14 years ago
by
cramakri
Browse files
Options
Downloads
Patches
Plain Diff
MINOR: Fix typo.
SVN: 19989
parent
405a3c25
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/openbis/dss/generic/shared/utils/SegmentedStoreUtils.java
+22
-21
22 additions, 21 deletions
...openbis/dss/generic/shared/utils/SegmentedStoreUtils.java
with
22 additions
and
21 deletions
datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/SegmentedStoreUtils.java
+
22
−
21
View file @
7764a8cd
...
@@ -47,13 +47,13 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SimpleDataSetInformationDTO;
...
@@ -47,13 +47,13 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SimpleDataSetInformationDTO;
/**
/**
* Utility methods for segmented stores.
* Utility methods for segmented stores.
*
*
* @author Franz-Josef Elmer
* @author Franz-Josef Elmer
*/
*/
public
class
SegmentedStoreUtils
public
class
SegmentedStoreUtils
{
{
private
static
final
String
RSYNC_EXEC
=
"rsync"
;
private
static
final
String
RSYNC_EXEC
=
"rsync"
;
private
static
final
Pattern
SHARE_ID_PATTERN
=
Pattern
.
compile
(
"[0-9]+"
);
private
static
final
Pattern
SHARE_ID_PATTERN
=
Pattern
.
compile
(
"[0-9]+"
);
private
static
final
FileFilter
FILTER_ON_SHARES
=
new
FileFilter
()
private
static
final
FileFilter
FILTER_ON_SHARES
=
new
FileFilter
()
...
@@ -112,12 +112,12 @@ public class SegmentedStoreUtils
...
@@ -112,12 +112,12 @@ public class SegmentedStoreUtils
{
{
throw
new
ConfigurationFailureException
(
throw
new
ConfigurationFailureException
(
"Couldn't create a test file in the following incoming folder: "
"Couldn't create a test file in the following incoming folder: "
+
incomingDataDirectory
,
ex
);
+
incomingDataDirectory
,
ex
);
}
}
File
matchingShare
=
findShare
(
testFile
,
shares
);
File
matchingShare
=
findShare
(
testFile
,
shares
);
return
matchingShare
.
getName
();
return
matchingShare
.
getName
();
}
}
private
static
File
findShare
(
File
testFile
,
File
[]
shares
)
private
static
File
findShare
(
File
testFile
,
File
[]
shares
)
{
{
for
(
File
share
:
shares
)
for
(
File
share
:
shares
)
...
@@ -131,7 +131,7 @@ public class SegmentedStoreUtils
...
@@ -131,7 +131,7 @@ public class SegmentedStoreUtils
}
}
testFile
.
delete
();
testFile
.
delete
();
throw
new
ConfigurationFailureException
(
throw
new
ConfigurationFailureException
(
"No
w
share could be found for the following incoming folder: "
"No share could be found for the following incoming folder: "
+
testFile
.
getParentFile
().
getAbsolutePath
());
+
testFile
.
getParentFile
().
getAbsolutePath
());
}
}
...
@@ -202,11 +202,11 @@ public class SegmentedStoreUtils
...
@@ -202,11 +202,11 @@ public class SegmentedStoreUtils
});
});
return
list
;
return
list
;
}
}
/**
/**
* Moves the specified data set to the specified share. The data set is folder in the store
* Moves the specified data set to the specified share. The data set is folder in the store
its
*
its
name is the data set code. The destination folder is <code>share</code>. Its name is
* name is the data set code. The destination folder is <code>share</code>. Its name is
the
*
the
share id.
* share id.
*
*
* @param service to access openBIS AS.
* @param service to access openBIS AS.
*/
*/
...
@@ -236,7 +236,7 @@ public class SegmentedStoreUtils
...
@@ -236,7 +236,7 @@ public class SegmentedStoreUtils
RsyncCopier
copier
=
new
RsyncCopier
(
OSUtilities
.
findExecutable
(
RSYNC_EXEC
));
RsyncCopier
copier
=
new
RsyncCopier
(
OSUtilities
.
findExecutable
(
RSYNC_EXEC
));
copier
.
copyContent
(
file
,
share
);
copier
.
copyContent
(
file
,
share
);
}
}
private
static
long
assertEqualSizeAndChildren
(
File
source
,
File
destination
)
private
static
long
assertEqualSizeAndChildren
(
File
source
,
File
destination
)
{
{
assertSameName
(
source
,
destination
);
assertSameName
(
source
,
destination
);
...
@@ -259,15 +259,15 @@ public class SegmentedStoreUtils
...
@@ -259,15 +259,15 @@ public class SegmentedStoreUtils
}
}
}
}
private
static
void
assertSameNumberOfChildren
(
File
source
,
File
[]
sourceFiles
,
File
destination
,
private
static
void
assertSameNumberOfChildren
(
File
source
,
File
[]
sourceFiles
,
File
[]
destinationFiles
)
File
destination
,
File
[]
destinationFiles
)
{
{
if
(
sourceFiles
.
length
!=
destinationFiles
.
length
)
if
(
sourceFiles
.
length
!=
destinationFiles
.
length
)
{
{
throw
new
EnvironmentFailureException
(
"Destination directory '"
throw
new
EnvironmentFailureException
(
"Destination directory '"
+
destination
.
getAbsolutePath
()
+
"' has "
+
destinationFiles
.
length
+
destination
.
getAbsolutePath
()
+
"' has "
+
destinationFiles
.
length
+
" files but source directory '"
+
source
.
getAbsolutePath
()
+
" files but source directory '"
+
source
.
getAbsolutePath
()
+
"' has "
+
"' has "
+
sourceFiles
.
length
+
" files."
);
+
sourceFiles
.
length
+
" files."
);
}
}
}
}
...
@@ -277,9 +277,9 @@ public class SegmentedStoreUtils
...
@@ -277,9 +277,9 @@ public class SegmentedStoreUtils
long
destinationSize
=
destination
.
length
();
long
destinationSize
=
destination
.
length
();
if
(
sourceSize
!=
destinationSize
)
if
(
sourceSize
!=
destinationSize
)
{
{
throw
new
EnvironmentFailureException
(
"Destination file '"
+
destination
.
getAbsolutePath
()
throw
new
EnvironmentFailureException
(
"Destination file '"
+
"' has size "
+
destinationSize
+
" but source file '"
+
destination
.
getAbsolutePath
()
+
"' has size "
+
destinationSize
+
source
.
getAbsolutePath
()
+
"' has size "
+
sourceSize
+
" but source file '"
+
source
.
getAbsolutePath
()
+
"' has size "
+
sourceSize
+
"."
);
+
"."
);
}
}
return
sourceSize
;
return
sourceSize
;
...
@@ -294,7 +294,7 @@ public class SegmentedStoreUtils
...
@@ -294,7 +294,7 @@ public class SegmentedStoreUtils
+
source
.
getAbsolutePath
()
+
"."
);
+
source
.
getAbsolutePath
()
+
"."
);
}
}
}
}
private
static
void
assertFile
(
File
file
)
private
static
void
assertFile
(
File
file
)
{
{
if
(
file
.
exists
()
==
false
)
if
(
file
.
exists
()
==
false
)
...
@@ -311,19 +311,20 @@ public class SegmentedStoreUtils
...
@@ -311,19 +311,20 @@ public class SegmentedStoreUtils
{
{
if
(
file
.
exists
()
==
false
)
if
(
file
.
exists
()
==
false
)
{
{
throw
new
EnvironmentFailureException
(
"Directory does not exist: "
+
file
.
getAbsolutePath
());
throw
new
EnvironmentFailureException
(
"Directory does not exist: "
+
file
.
getAbsolutePath
());
}
}
if
(
file
.
isDirectory
()
==
false
)
if
(
file
.
isDirectory
()
==
false
)
{
{
throw
new
EnvironmentFailureException
(
"Directory is a file: "
+
file
.
getAbsolutePath
());
throw
new
EnvironmentFailureException
(
"Directory is a file: "
+
file
.
getAbsolutePath
());
}
}
}
}
private
static
File
[]
getFiles
(
File
file
)
private
static
File
[]
getFiles
(
File
file
)
{
{
File
[]
files
=
file
.
listFiles
();
File
[]
files
=
file
.
listFiles
();
Arrays
.
sort
(
files
);
Arrays
.
sort
(
files
);
return
files
;
return
files
;
}
}
}
}
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