On Nov 19, 2007, at 6:51 AM, Rob Heittman wrote:
In my noodling with DAV method support, COPY and MOVE are especially
challenging to implement. By extending Directory and friends, you
can model a COPY as a GET and a PUT, and a MOVE as a GET, DELETE,
and PUT, but this is messy, not atomic in the right ways, and not
very performant. Really you need to have COPY and MOVE supported
down through the client as well. This is a lot easier if you just
check out trunk and hack on it, than by trying to extend everything
and coerce Restlet to use the extended classes.
I've figured out that to do this "right", yes: you do need to extend
DirectoryResource. The problem with that is that Engine insists on
creating an instance of DirectoryResource and not an instance of one's
derived class. So that means one has to subclass Engine and then
figure out how to get engineClassName in Engine.getInstance() be one's
own derived class. (Is there an easy way to do that?) Anyway, it
seems like a lot of messy work.
Aside: Why does Engine have a lone createDirectoryResource() method at
all? It seems like overly-tight coupling. Why isn't there an easier-
to-alter Factor pattern for creating directory resources?
But something that would go a long way toward implementing COPY and
MOVE would be simply to provide stubs for them, specifically:
1. Add COPY and MOVE to Method.
2. Add allowCopy() and allowMove() to Resource.
Of course, I'm a newbie. Would doing just items 1 and 2 above be good
enough to allow even a simple implementation of COPY and MOVE?
- Paul