Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GitWrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
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
Georg Seibt
GitWrapper
Commits
63af3357
Commit
63af3357
authored
8 years ago
by
Georg Seibt
Browse files
Options
Downloads
Patches
Plain Diff
doc, ensure the isSane() method only performs its checks once (if it returned successful)
parent
a218ff59
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/de/uni_passau/fim/seibt/gitwrapper/process/ToolWrapper.java
+30
-1
30 additions, 1 deletion
.../uni_passau/fim/seibt/gitwrapper/process/ToolWrapper.java
with
30 additions
and
1 deletion
src/de/uni_passau/fim/seibt/gitwrapper/process/ToolWrapper.java
+
30
−
1
View file @
63af3357
...
...
@@ -7,11 +7,23 @@ import java.util.Optional;
import
de.uni_passau.fim.seibt.gitwrapper.process.ProcessExecutor.ExecRes
;
/**
* Abstract superclass of all wrappers for external tools.
*/
public
abstract
class
ToolWrapper
{
protected
String
cmd
;
public
ToolWrapper
(
String
cmd
)
throws
ToolNotWorkingException
{
/**
* Constructs a new {@link ToolWrapper} wrapping the given external command <code>cmd</code>. Calls
* {@link #isWorking()} and throws a {@link ToolNotWorkingException} if it returns <code>false</code>.
*
* @param cmd
* the external command to wrap
* @throws ToolNotWorkingException
* if {@link #isWorking()} returns <code>false</code>
*/
protected
ToolWrapper
(
String
cmd
)
throws
ToolNotWorkingException
{
this
.
cmd
=
cmd
;
if
(!
isWorking
())
{
...
...
@@ -19,8 +31,25 @@ public abstract class ToolWrapper {
}
}
/**
* Determines whether the wrapped command is working as expected.
*
* @return true iff the command is working
*/
protected
abstract
boolean
isWorking
();
/**
* Prepends the wrapped external command to (a copy of) the <code>parameters</code> and calls
* {@link ProcessExecutor#exec(File, boolean, List)}.
*
* @param workingDir
* the working directory for the execution
* @param redirectError
* whether to merge the standard output and error streams
* @param parameters
* the parameters for the external command
* @return the result of the execution or an empty {@link Optional} if there is an exception executing the command
*/
protected
Optional
<
ExecRes
>
exec
(
File
workingDir
,
boolean
redirectError
,
List
<
String
>
parameters
)
{
LinkedList
<
String
>
pars
=
new
LinkedList
<>(
parameters
);
pars
.
addFirst
(
cmd
);
...
...
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