Skip to content

Instantly share code, notes, and snippets.

@aruld
Created August 12, 2011 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aruld/1141507 to your computer and use it in GitHub Desktop.
Save aruld/1141507 to your computer and use it in GitHub Desktop.
SCPAction example
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