Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 304959 - Add after-commit callback to IRepository.WriteAccessHandler
Summary: Add after-commit callback to IRepository.WriteAccessHandler
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 3.0   Edit
Hardware: PC All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-08 02:49 EST by Cyril Jaquier CLA
Modified: 2010-06-29 09:22 EDT (History)
0 users

See Also:
stepper: documentation+


Attachments
Adds a "handleTransactionAfterCommitting" method to IRepository.WriteAccessHandler. (7.28 KB, patch)
2010-03-08 02:53 EST, Cyril Jaquier CLA
stepper: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cyril Jaquier CLA 2010-03-08 02:49:07 EST
Build Identifier: 

Currently, IRepository.WriteAccessHandler has only a pre-commit callback (handleTransactionBeforeCommitting). A post-commit callback would be useful too.

In our case, we need such a post-commit handler in order to be notified of every successful commits. We extract information from the CommitContext and synchronize an external model with it.

Reproducible: Always
Comment 1 Cyril Jaquier CLA 2010-03-08 02:53:54 EST
Created attachment 161263 [details]
Adds a "handleTransactionAfterCommitting" method to IRepository.WriteAccessHandler.

This patch does not apply nicely to HEAD anymore. However the failed hunks are easy to fix.
Comment 2 Eike Stepper CLA 2010-03-10 01:41:40 EST
Hi Cyril, thank you for this patch. Note that I change the parameter order in the new handler method.

Please confirm the following:

1) The number of lines that you changed is smaller than 250.
2) You are the only author of these changed lines.
3) You apply the EPL to these changed lines.
Comment 3 Cyril Jaquier CLA 2010-03-10 10:01:30 EST
(In reply to comment #2)
> Hi Cyril, thank you for this patch. Note that I change the parameter order in
> the new handler method.
> 

Do you need a new one that applies cleanly to HEAD?

> Please confirm the following:
> 
> 1) The number of lines that you changed is smaller than 250.

Yes.

> 2) You are the only author of these changed lines.

Erwin Betschart is the author of the patch. He is the only author.

> 3) You apply the EPL to these changed lines.

Yes, EPL is alright.

Thank you.
Comment 4 Eike Stepper CLA 2010-03-10 10:16:56 EST
Thank you, Erwin ;-)

Committed to HEAD
Comment 5 Eike Stepper CLA 2010-05-08 02:52:34 EDT
Attention: The new call-back hook has been renamed to handleTransactionAfterCommitted() !!!
Comment 6 Eike Stepper CLA 2010-05-08 03:07:22 EDT
Example:

    IRepository repository = CDOServerUtil.createRepository("myrepo", store, props);
    repository.addHandler(new IRepository.WriteAccessHandler()
    {
      public void handleTransactionBeforeCommitting(ITransaction transaction,
          IStoreAccessor.CommitContext commitContext, OMMonitor monitor) throws RuntimeException
      {
        System.out.println("About to commit " + transaction);
      }

      public void handleTransactionAfterCommitted(ITransaction transaction,
          IStoreAccessor.CommitContext commitContext, OMMonitor monitor)
      {
        System.out.println("Committed " + transaction);
      }
    });
Comment 7 Eike Stepper CLA 2010-06-29 04:40:09 EDT
Available in 3.0 GA:
http://download.eclipse.org/modeling/emf/cdo/updates/3.0-releases/