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
6cc4b63b
Commit
6cc4b63b
authored
16 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
change: - Extract private method 'findExecutable'.
SVN: 6298
parent
9f95258e
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
datamover/source/java/ch/systemsx/cisd/datamover/filesystem/FileSysOperationsFactory.java
+16
-30
16 additions, 30 deletions
...x/cisd/datamover/filesystem/FileSysOperationsFactory.java
with
16 additions
and
30 deletions
datamover/source/java/ch/systemsx/cisd/datamover/filesystem/FileSysOperationsFactory.java
+
16
−
30
View file @
6cc4b63b
...
@@ -57,25 +57,23 @@ public class FileSysOperationsFactory implements IFileSysOperationsFactory
...
@@ -57,25 +57,23 @@ public class FileSysOperationsFactory implements IFileSysOperationsFactory
this
.
parameters
=
parameters
;
this
.
parameters
=
parameters
;
}
}
private
final
static
File
findRsyncExecutable
(
final
String
rsyncExecutablePath
)
private
final
static
File
findExecutable
(
final
String
executablePath
,
final
String
executableName
)
{
{
final
File
rsyncE
xecutable
;
final
File
e
xecutable
File
;
if
(
rsyncE
xecutablePath
!=
null
)
if
(
StringUtils
.
isNotBlank
(
e
xecutablePath
)
)
{
{
rsyncExecutable
=
new
File
(
rsyncExecutablePath
);
executableFile
=
new
File
(
executablePath
);
}
else
if
(
OSUtilities
.
isWindows
()
==
false
)
{
rsyncExecutable
=
OSUtilities
.
findExecutable
(
"rsync"
);
}
else
}
else
{
{
rsyncE
xecutable
=
null
;
e
xecutable
File
=
OSUtilities
.
findExecutable
(
executableName
)
;
}
}
if
(
rsyncE
xecutable
!=
null
&&
OSUtilities
.
executableExists
(
rsyncE
xecutable
)
==
false
)
if
(
e
xecutable
File
!=
null
&&
OSUtilities
.
executableExists
(
e
xecutable
File
)
==
false
)
{
{
throw
ConfigurationFailureException
.
fromTemplate
(
"Cannot find
rsync
executable '%s'."
,
throw
ConfigurationFailureException
.
fromTemplate
(
"Cannot find executable '%s'."
,
rsyncE
xecutable
.
getAbsoluteFile
());
e
xecutable
File
.
getAbsoluteFile
());
}
}
return
rsyncE
xecutable
;
return
e
xecutable
File
;
}
}
private
final
IPathImmutableCopier
createFakedImmCopier
()
private
final
IPathImmutableCopier
createFakedImmCopier
()
...
@@ -110,7 +108,8 @@ public class FileSysOperationsFactory implements IFileSysOperationsFactory
...
@@ -110,7 +108,8 @@ public class FileSysOperationsFactory implements IFileSysOperationsFactory
public
final
IPathRemover
getRemover
()
public
final
IPathRemover
getRemover
()
{
{
return
new
RetryingPathRemover
(
MAX_RETRIES_ON_FAILURE
,
Constants
.
MILLIS_TO_SLEEP_BEFORE_RETRYING
);
return
new
RetryingPathRemover
(
MAX_RETRIES_ON_FAILURE
,
Constants
.
MILLIS_TO_SLEEP_BEFORE_RETRYING
);
}
}
public
final
IPathImmutableCopier
getImmutableCopier
()
public
final
IPathImmutableCopier
getImmutableCopier
()
...
@@ -135,7 +134,7 @@ public class FileSysOperationsFactory implements IFileSysOperationsFactory
...
@@ -135,7 +134,7 @@ public class FileSysOperationsFactory implements IFileSysOperationsFactory
public
final
IPathCopier
getCopier
(
final
boolean
requiresDeletionBeforeCreation
)
public
final
IPathCopier
getCopier
(
final
boolean
requiresDeletionBeforeCreation
)
{
{
final
File
rsyncExecutable
=
find
Rsync
Executable
(
parameters
.
getRsyncExecutable
());
final
File
rsyncExecutable
=
findExecutable
(
parameters
.
getRsyncExecutable
()
,
"rsync"
);
final
File
sshExecutable
=
tryFindSshExecutable
();
final
File
sshExecutable
=
tryFindSshExecutable
();
if
(
rsyncExecutable
!=
null
)
if
(
rsyncExecutable
!=
null
)
{
{
...
@@ -149,25 +148,12 @@ public class FileSysOperationsFactory implements IFileSysOperationsFactory
...
@@ -149,25 +148,12 @@ public class FileSysOperationsFactory implements IFileSysOperationsFactory
public
final
File
tryFindSshExecutable
()
public
final
File
tryFindSshExecutable
()
{
{
final
String
sshExecutablePath
=
parameters
.
getSshExecutable
();
return
findExecutable
(
parameters
.
getSshExecutable
(),
"ssh"
);
File
sshExecutable
=
null
;
if
(
StringUtils
.
isNotBlank
(
sshExecutablePath
))
{
sshExecutable
=
new
File
(
sshExecutablePath
);
}
else
{
sshExecutable
=
OSUtilities
.
findExecutable
(
"ssh"
);
}
if
(
sshExecutable
!=
null
&&
OSUtilities
.
executableExists
(
sshExecutable
)
==
false
)
{
throw
ConfigurationFailureException
.
fromTemplate
(
"Cannot find ssh executable '%s'."
,
sshExecutable
.
getAbsoluteFile
());
}
return
sshExecutable
;
}
}
public
final
IPathMover
getMover
()
public
final
IPathMover
getMover
()
{
{
return
new
RetryingPathMover
(
MAX_RETRIES_ON_FAILURE
,
Constants
.
MILLIS_TO_SLEEP_BEFORE_RETRYING
);
return
new
RetryingPathMover
(
MAX_RETRIES_ON_FAILURE
,
Constants
.
MILLIS_TO_SLEEP_BEFORE_RETRYING
);
}
}
}
}
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