Created
August 12, 2011 05:18
-
-
Save aruld/1141507 to your computer and use it in GitHub Desktop.
SCPAction example
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
Factory factory = Factory.makeInstance(); | |
EngineHelper helper = factory.makeEngineHelper(); | |
FlowChart flowChart = helper.makeFlowChart("SCP Action Example"); | |
SCPActionFactory scpActionFactory = (SCPActionFactory) flowChart.makeFactory("SCPActionFactory"); | |
SCPAction downloadFile = scpActionFactory.makeSCPAction("SCP Download"); | |
downloadFile.setHost("arul-ubuntu"); | |
downloadFile.setUsername(System.getProperty("user.name")); | |
downloadFile.setDownload(true); | |
downloadFile.setRemotePath("Downloads/jdk-1_5_0_22-linux-i586.bin"); | |
downloadFile.setLocalPath("/tmp/"); | |
SCPAction uploadFile = scpActionFactory.makeSCPAction("SCP Upload"); | |
uploadFile.setHost("arul-ubuntu"); | |
uploadFile.setUsername(System.getProperty("user.name")); | |
uploadFile.setDownload(false); | |
uploadFile.setRemotePath("/tmp/"); | |
uploadFile.setLocalPath("/tmp/jdk-1_5_0_22-linux-i586.bin"); | |
downloadFile.addFlow(uploadFile); | |
SCPAction remoteExec = scpActionFactory.makeSCPAction("Remote Exec"); | |
remoteExec.setHost("arul-ubuntu"); | |
remoteExec.setUsername(System.getProperty("user.name")); | |
remoteExec.setRemoteCommand("df;uptime"); | |
uploadFile.addFlow(remoteExec); | |
JavaAction javaAction = flowChart.makeJavaAction("Java Action"); | |
javaAction.setListener(RemoteCommandResult.class); | |
remoteExec.addFlow(javaAction); | |
String name = engine.put(flowChart); | |
System.out.println("Scheduled job : " + name); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment