/*package*/BatchResults( Request request ) {
this.requests = Collections.singletonList(request);
// Now create the results ...
if (request instanceof ReadAllPropertiesRequest) {
ReadAllPropertiesRequest read = (ReadAllPropertiesRequest)request;
DateTime expires = computeExpirationTime(read);
getOrCreateNode(read.getActualLocationOfNode(), expires).setProperties(read.getPropertiesByName());
} else if (request instanceof ReadPropertyRequest) {
ReadPropertyRequest read = (ReadPropertyRequest)request;
DateTime expires = computeExpirationTime(read);
getOrCreateNode(read.getActualLocationOfNode(), expires).addProperty(read.getProperty());
} else if (request instanceof ReadNodeRequest) {
ReadNodeRequest read = (ReadNodeRequest)request;
DateTime expires = computeExpirationTime(read);
BatchResultsNode node = getOrCreateNode(read.getActualLocationOfNode(), expires);
node.setProperties(read.getPropertiesByName());
node.setChildren(read.getChildren());
} else if (request instanceof ReadBlockOfChildrenRequest) {
throw new IllegalStateException();
} else if (request instanceof ReadAllChildrenRequest) {
ReadAllChildrenRequest read = (ReadAllChildrenRequest)request;
DateTime expires = computeExpirationTime(read);
getOrCreateNode(read.getActualLocationOfNode(), expires).setChildren(read.getChildren());
} else if (request instanceof ReadBranchRequest) {
ReadBranchRequest read = (ReadBranchRequest)request;
DateTime expires = computeExpirationTime(read);
for (Location location : read) {
BatchResultsNode node = getOrCreateNode(location, expires);
node.setProperties(read.getPropertiesFor(location));
node.setChildren(read.getChildren(location));
}