Search in sources :

Example 1 with End

use of org.structr.cloud.message.End in project structr by structr.

the class PushTransmission method doRemote.

@Override
public Boolean doRemote(final CloudConnection client) throws IOException, FrameworkException {
    // reset sequence number
    sequenceNumber = 0;
    // send child nodes when recursive sending is requested
    final Set<NodeInterface> nodes = exportSet.getNodes();
    for (final NodeInterface n : nodes) {
        if (n instanceof File) {
            sendFile(client, (File) n, CloudService.CHUNK_SIZE);
        } else {
            client.send(new NodeDataContainer(n, sequenceNumber++));
        }
    }
    // send relationships
    Set<RelationshipInterface> rels = exportSet.getRelationships();
    for (RelationshipInterface r : rels) {
        if (nodes.contains(r.getSourceNode()) && nodes.contains(r.getTargetNode())) {
            client.send(new RelationshipDataContainer(r, sequenceNumber++));
        } else {
            System.out.println("NOT sending relationship data container " + r + " because source or target node are not in the export set.");
        }
    }
    client.send(new End());
    // wait for end of transmission
    client.waitForTransmission();
    return true;
}
Also used : RelationshipDataContainer(org.structr.cloud.message.RelationshipDataContainer) RelationshipInterface(org.structr.core.graph.RelationshipInterface) FileNodeDataContainer(org.structr.cloud.message.FileNodeDataContainer) NodeDataContainer(org.structr.cloud.message.NodeDataContainer) End(org.structr.cloud.message.End) File(org.structr.dynamic.File) NodeInterface(org.structr.core.graph.NodeInterface)

Example 2 with End

use of org.structr.cloud.message.End in project structr by structr.

the class SingleTransmission method doRemote.

@Override
public T doRemote(final CloudConnection<T> client) throws IOException, FrameworkException {
    client.send(packet);
    client.send(new End());
    client.waitForTransmission();
    return client.getPayload();
}
Also used : End(org.structr.cloud.message.End)

Aggregations

End (org.structr.cloud.message.End)2 FileNodeDataContainer (org.structr.cloud.message.FileNodeDataContainer)1 NodeDataContainer (org.structr.cloud.message.NodeDataContainer)1 RelationshipDataContainer (org.structr.cloud.message.RelationshipDataContainer)1 NodeInterface (org.structr.core.graph.NodeInterface)1 RelationshipInterface (org.structr.core.graph.RelationshipInterface)1 File (org.structr.dynamic.File)1