Package com.mooltiverse.oss.nyx.command
Class Clean
- java.lang.Object
-
- com.mooltiverse.oss.nyx.command.AbstractCommand
-
- com.mooltiverse.oss.nyx.command.Clean
-
- All Implemented Interfaces:
Command
public class Clean extends AbstractCommand
The Clean command takes care of cleaning the release process and reverting the repository state to its initial state. This class is not meant to be used in multi-threaded environments.
-
-
Constructor Summary
Constructors Constructor Description Clean(State state, Repository repository)
Standard constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isUpToDate()
Returnstrue
if this command is up to date, which means that the internal state (Command.state()
) would not change by running (Command.run()
) the command again.State
run()
Reverts the workspace to its initial state and returnsnull
.-
Methods inherited from class com.mooltiverse.oss.nyx.command.AbstractCommand
getLatestCommit, isRepositoryClean, repository, state
-
-
-
-
Constructor Detail
-
Clean
public Clean(State state, Repository repository)
Standard constructor.- Parameters:
state
- the state referencerepository
- the repository reference- Throws:
NullPointerException
- if a given argument isnull
-
-
Method Detail
-
isUpToDate
public boolean isUpToDate() throws DataAccessException, IllegalPropertyException, GitException
Returnstrue
if this command is up to date, which means that the internal state (Command.state()
) would not change by running (Command.run()
) the command again. It other words, when this method returnstrue
any invocation of the (Command.run()
) method is needless and idempotent about the state. This method uses the quickest method to verify whether the state is up to date or not. This method must not rely on dependencies and it must always evaluate its own status independently.- Returns:
true
if this command is up to date- Throws:
DataAccessException
- in case the configuration can't be loaded for some reason.IllegalPropertyException
- in case the configuration has some illegal options.GitException
- in case of unexpected issues when accessing the Git repository.- See Also:
Command.state()
,Command.run()
-
run
public State run() throws DataAccessException, IllegalPropertyException, GitException, ReleaseException
Reverts the workspace to its initial state and returnsnull
.- Returns:
null
as the state has to be invalidated for all commands by this command.- Throws:
DataAccessException
- in case the configuration can't be loaded for some reason.IllegalPropertyException
- in case the configuration has some illegal options.GitException
- in case of unexpected issues when accessing the Git repository.ReleaseException
- if the task is unable to complete for reasons due to the release process.- See Also:
Command.isUpToDate()
,Command.state()
-
-