Resource modification hooks
Most of the interesting function associated with a repository provider
occurs as the user works with resources in the project that is configured for
the provider. In order to be aware of changes the user makes to a
resource, the provider can implement resource
modification hooks. The resources plug-in provides these hooks as
extension points. The documentation for IMoveDeleteHook
and IFileModificationValidator
describe the details for implementing these hooks.
The team plug-in optimizes and simplifies the association of the hook with
appropriate resources by registering generic hooks with the resources
plug-in. These generic hooks simply look up the repository provider for a
given resource and obtain its hook. This has the advantage of calling only
one provider hook rather than having each provider implementation register a
hook that must first check whether the resource is managed by the provider.
What this means to your plug-in is that you provide any necessary hooks by
overriding methods in RepositoryProvider.
The default implementation of these methods answers null, indicating that
no hook is necessary.
- getMoveDeleteHook - answers an IMoveDeleteHook
appropriate for the provider. This hook allows providers to control
how moves and deletes occur and includes the ability to prevent them from
happening. Implementors can provide alternate implementations for
moving or deleting files, folders, and projects. The CVS client uses
this hook to monitor folder deletions and ensure that any files contained in
deleted folders are remembered so that they can later be deleted from the
repository if desired.
- getFileModificationValidator - answers an IFileModificationValidator
appropriate for the provider. This hook allows providers to pre-check
any modifications or saves to files. This hook is typically needed
when a repository provider wants to implement pessimistic versioning.
In pessimistic versioning, a file must be checked out before modifying it,
and only one client can check out a file at any given time.
Pessimistic versioning could be implemented by checking out a file (if not
already checked out) whenever a file is edited, and checking the file back
in when it is saved. Since CVS uses an optimistic versioning scheme, it does
not implement this hook.
