/**
* Copyright (C) 2010-2014 Morgner UG (haftungsbeschränkt)
*
* This file is part of Structr <http://structr.org>.
*
* Structr is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Structr is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Structr. If not, see <http://www.gnu.org/licenses/>.
*/
package org.structr.cloud.transmission;
import java.io.IOException;
import org.structr.cloud.CloudConnection;
import org.structr.cloud.message.PullNodeRequestContainer;
import org.structr.common.error.FrameworkException;
/**
*
* @author Christian Morgner
*/
public class PullTransmission extends AbstractTransmission<Boolean> {
private boolean recursive = false;
private String rootNodeId = null;
public PullTransmission(final String rootNodeId, final boolean recursive, final String userName, final String password, final String remoteHost, final int port) {
super(userName, password, remoteHost, port);
this.rootNodeId = rootNodeId;
this.recursive = recursive;
}
@Override
public int getTotalSize() {
return 1;
}
@Override
public Boolean doRemote(final CloudConnection client) throws IOException, FrameworkException {
// send type of request
client.send(new PullNodeRequestContainer(rootNodeId, recursive));
// wait for end of transmission
client.waitForTransmission();
return true;
}
}