Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 249278

Summary: Provide interceptors at the server-side to run validation, filtering, ...
Product: [Modeling] EMF Reporter: Thomas Schindl <tom.schindl>
Component: cdo.coreAssignee: Eike Stepper <stepper>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mtaal, smcduff, stepper
Version: 2.0Flags: stepper: galileo+
Target Milestone: M3   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard: Power to the People

Description Thomas Schindl CLA 2008-10-01 04:43:44 EDT
It would be great if the CDO-Server would allow to intercept before sending/receiving(persisting) data to provide server-side-filtering of data, run custom checks, start async-processes to e.g. send out mails, ...

1. Use case 1 (Privileg system => Filtering/Checking)
-----------------------------------------------------
As I see it currently CDO is sending all data to the client it requested and filtering of data (e.g. not showing model parts the because the user doesn't has the privileg see them) has to happen there. In the other direction the same applies e.g. to data the user only has the privileg to see but not modify (the UI can prevent the user from doing so).

Both things assume that the server can trust the client and if different clients connect to the same application the logic has to be at every client.

2. User case 2 (Server-Side checks)
-----------------------------------
Take an order system where the client sends Credit Card informations. Those have to be checked against an external Webservice before they can get persisted. This only one example and many others

3. Use case 3 (Triggering Async-Actions)
----------------------------------------
E.g. if a new order is received in the system a mail is sent out, ... . I know I could do this with a Database-Trigger but it would be a better to stay database independed to have this triggered by the CDO-Server after it persits a model.
Comment 1 Eike Stepper CLA 2008-10-01 06:11:13 EDT
I think for write operations (there is only one: commit) this should be easy. 

On the other hand we have different kinds of read access, e.g. read meta data like packages, read instance data like IStoreReader.readRevisionXyz() and read instance infos like IStoreReader.readResourceID(). Would it be enough to provide hooks for simple revision read access?
Comment 2 Thomas Schindl CLA 2008-10-01 07:54:08 EDT
I think for my purpose it is enough. The main purpose is to filter data before sending them to client because he's not allowed to see them.
Comment 3 Eike Stepper CLA 2008-10-01 09:06:25 EDT
I've added these new interfaces:

- IRepository.ReadAccessHandler
- IRepository.WriteAccessHandler

as well as IRepository API to add and remove handlers.
org.eclipse.emf.cdo.tests.RepositoryTest contains tests/examples for such handlers.

Committed to HEAD.
Comment 4 Thomas Schindl CLA 2008-10-01 09:57:22 EDT
Amazing I'll see how i can exploit this feature and give you feedback!
Comment 5 Eike Stepper CLA 2008-10-09 16:16:48 EDT
Fix available in CDO 2.0.0 I200810091534
Comment 6 Eike Stepper CLA 2009-06-27 11:48:14 EDT
Generally available.