@Override
public <S extends ResourceSnapshot> S find(
Class<? extends S> snapshotClass,
Name<?> name,
Class<? extends ResourceHandler> handlerClass) {
checkNotNull(snapshotClass,"Resource snapshot class cannot be null");
checkNotNull(name,RESOURCE_NAME_CANNOT_BE_NULL);
checkNotNull(handlerClass,"Resource handler class cannot be null");
checkArgument(!ContainerSnapshot.class.isAssignableFrom(snapshotClass) || ContainerHandler.class.isAssignableFrom(handlerClass),"Incompatible snapshot and handler classes ('%s' instances are not handled by '%s')",snapshotClass.getCanonicalName(),handlerClass.getCanonicalName());
ResourceTemplate template=this.writeSessionService.templateManagementService().templateOfHandler(handlerClass);
checkArgument(template!=null,"Handler class '%s' is not associated to any existing template",handlerClass.getCanonicalName());
checkArgument(Snapshots.areCompatible(snapshotClass,template),"Cannot wrap an object managed by '%s' with an snapshot of type '%s'",handlerClass.getCanonicalName(),snapshotClass.getCanonicalName());
checkState(this.status.equals(Status.ACTIVE),WRITE_SESSION_NOT_ACTIVE,this.status);
ResourceId id=ResourceId.createId(name,template);
DelegatedResourceSnapshot resource = resolveResource(id, template);
return snapshotClass.cast(resource);
}