Bug 273562 - Make EObjects available at the server-side
Summary: Make EObjects available at the server-side
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard: Power to the People
Keywords: noteworthy
Depends on:
Blocks: 245658
  Show dependency tree
 
Reported: 2009-04-24 04:47 EDT by Eike Stepper CLA
Modified: 2011-06-23 03:37 EDT (History)
6 users (show)

See Also:


Attachments
Patch v1 (115.70 KB, patch)
2010-09-24 05:41 EDT, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eike Stepper CLA 2009-04-24 04:47:10 EDT
With bug 265435 we have now the foundation for EObjects at the server-side. Possible benefits:

1) Easier IStore implementation
2) Ability to call generated EOperations
3) Ability to use custom EDataType serialization
4) Ability to use existing EObject-based Tooling server-side
Comment 1 Eike Stepper CLA 2009-11-01 05:58:09 EST
Rebasing all unresolved enhancement requests to 3.0
Comment 2 Eike Stepper CLA 2010-06-29 04:49:54 EDT
Rebasing all outstanding enhancements requests to version 4.0
Comment 3 Eike Stepper CLA 2010-09-24 05:41:53 EDT
Created attachment 179507 [details]
Patch v1

This is a functional patch, but not well tested
Comment 4 Eike Stepper CLA 2010-09-24 05:45:54 EDT
Development happens in branch objects_on_server for these projects:
	org.eclipse.emf.cdo
	org.eclipse.emf.cdo.server
	org.eclipse.emf.cdo.tests
Comment 5 Eike Stepper CLA 2010-09-24 05:50:02 EDT
The patch contains a usage example in RepositoryTest.testWriteAccessHandlers_WithServerCDOView():

      public void handleTransactionBeforeCommitting(ITransaction transaction, CommitContext commitContext,
          OMMonitor monitor) throws RuntimeException
      {
        CDOView view = CDOServerUtil.openView(commitContext, isConfig(LEGACY));
        for (CDORevision revision : commitContext.getNewObjects())
        {
          CDOObject object = view.getObject(revision.getID());
          if (object instanceof Customer)
          {
            Customer customer = (Customer)object;
            String name = customer.getName();
            if ("Admin".equals(name))
            {
              throw new IllegalStateException("Adding a customer with name 'Admin' is not allowed");
            }
          }
        }

        view.close();
      }

Note the differences compared to RepositoryTest.testWriteAccessHandlers()!
Comment 6 Eike Stepper CLA 2010-09-24 05:52:05 EDT
Server-side CDOViews can be opened with these factory methods:

	CDOServerUtil.openView(ISession, CDOBranchPoint, boolean, CDORevisionProvider)
	CDOServerUtil.openView(IView, boolean)
	CDOServerUtil.openView(IStoreAccessor.CommitContext, boolean)
Comment 7 Eike Stepper CLA 2010-09-24 05:53:31 EDT
Everybody who's interested in this new feature, please test it and let me know if it works for you ;-)
Comment 8 Eike Stepper CLA 2010-09-24 07:12:41 EDT
With the new org.eclipse.emf.cdo.spi.server.ObjectWriteAccessHandler it becomes even easier:

      @Override
      protected void handleTransactionBeforeCommitting(OMMonitor monitor) throws RuntimeException
      {
        for (EObject object : getNewObjects())
        {
          if (object instanceof Customer)
          {
            Customer customer = (Customer)object;
            String name = customer.getName();
            if ("Admin".equals(name))
            {
              throw new IllegalStateException("Adding a customer with name 'Admin' is not allowed");
            }
          }
        }
      }
Comment 9 Eike Stepper CLA 2010-10-01 10:30:06 EDT
Committed to HEAD
Comment 10 Eike Stepper CLA 2011-06-23 03:37:04 EDT
Available in R20110608-1407