-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backup / restore with added.txt marker file
- Loading branch information
Benoit Moussaud
committed
Dec 9, 2015
1 parent
699fc25
commit 3a2f0bc
Showing
6 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/ext/deployit/community/extra/steps/action/Added.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS | ||
* FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS. | ||
*/ | ||
package ext.deployit.community.extra.steps.action; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Properties; | ||
|
||
import com.xebialabs.deployit.plugin.api.flow.ExecutionContext; | ||
import com.xebialabs.overthere.OverthereFile; | ||
|
||
|
||
public class Added extends BaseAction { | ||
|
||
private final OverthereFile artifactFile; | ||
private final OverthereFile directory; | ||
|
||
public Added(final OverthereFile directory, final OverthereFile artifactFile) { | ||
this.directory = directory; | ||
this.artifactFile = artifactFile; | ||
} | ||
|
||
@Override | ||
public void execute(final ExecutionContext ctx) { | ||
Properties added = new Properties(); | ||
try { | ||
final OverthereFile addedFile = getAddedFile(); | ||
if (addedFile.exists()) { | ||
final InputStream inputStream = addedFile.getInputStream(); | ||
added.load(inputStream); | ||
inputStream.close(); | ||
} | ||
added.setProperty(artifactFile.getPath(), "ADD"); | ||
added.store(addedFile.getOutputStream(), ""); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private OverthereFile getAddedFile() { | ||
return directory.getFile("added.txt"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters