class WorkspaceResource extends TransactionalResource {

    @Timed
    @Path("snapshot")
    @GET
    public String snapshot(@Auth AuthorizedPrincipal principal,
                           @Context DSLContext create) {
        return readOnly(principal, model -> {
            Agency p = model.getCurrentPrincipal()
                            .getPrincipal();
            WorkspaceSnapshot snapshot = model.snapshot();
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                snapshot.serializeTo(baos);
            } catch (Exception e) {
                log.info(String.format("Failed serializing snapshot by: %s:%s",
                                       p.getName(), p.getId()),
                         e);
                throw new WebApplicationException(String.format("Failed serializing snapshot: %s",
                                                                e.getMessage()),
                                                  Status.BAD_REQUEST);
            }
            return baos.toString();
        }, create);
    }

    public  WorkspaceResource();
    public  WorkspaceResource(URLClassLoader executionScope);

}