if (getLogger().isDebugEnabled()) {
getLogger().debug("copy: " + source.getURI() + " -> " + destination.getURI());
}
if (source instanceof TraversableSource) {
final TraversableSource origin = (TraversableSource) source;
ModifiableTraversableSource target = null;
if (origin.isCollection()) {
if (!(destination instanceof ModifiableTraversableSource)) {
final String message = "copy() is forbidden: " +
"Cannot create a collection at the indicated destination.";
getLogger().warn(message);
return STATUS_FORBIDDEN;
}
// TODO: copy properties
target = ((ModifiableTraversableSource) destination);
target.makeCollection();
if (recurse) {
Iterator children = origin.getChildren().iterator();
while (children.hasNext()) {
TraversableSource child = (TraversableSource) children.next();
int status = copy(child,target.getChild(child.getName()),recurse);
// TODO: record this status
// according to the spec we must continue moving files even though
// a part of the move has not succeeded
}
}