return actionDecider;
}
@Override
public TaskTree execute(Profile profile, boolean interactive) throws FileSystemException, URISyntaxException, DataParseException, IOException {
Site d1 = null, d2 = null;
RuleSet rules = profile.getRuleSet().createRuleSet();
ActionDecider actionDecider;
if (profile.getSynchronizationType().equals("Publish/Update")) {
actionDecider = new PublishActionDecider();
}
else if (profile.getSynchronizationType().equals("Publish/Update Overwrite")) {
actionDecider = new PublishOverwriteActionDecider();
}
else if (profile.getSynchronizationType().equals("Backup Copy")) {
actionDecider = new BackupActionDecider();
}
else if (profile.getSynchronizationType().equals("Exact Copy")) {
actionDecider = new ExactCopyActionDecider();
}
else if (profile.getSynchronizationType().equals("Two Way Sync")) {
actionDecider = new TwoWaySyncActionDecider();
}
else {
throw new IllegalArgumentException("Profile has unknown synchronization type.");
}
try {
ConnectionDescription srcDesc = profile.getSource();
ConnectionDescription dstDesc = profile.getDestination();
if (interactive) {
srcDesc.setParameter("interactive", "true");
dstDesc.setParameter("interactive", "true");
}
d1 = fsm.createConnection(srcDesc);
d2 = fsm.createConnection(dstDesc);
return execute(d1, d2, actionDecider, rules);
}
catch (FileSystemException ex) {
if (d1 != null) {
d1.close();
}
if (d2 != null) {
d2.close();
}
throw ex;