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

Bug 352330

Summary: Make lockArea loading vetoable
Product: [Modeling] EMF Reporter: Caspar D. <caspar_d>
Component: cdo.coreAssignee: Caspar D. <caspar_d>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 CC: saulius.tvarijonas
Version: 4.1Flags: stepper: review+
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 351793    
Bug Blocks:    
Attachments:
Description Flags
Patch v1
none
Patch v2 none

Description Caspar D. CLA 2011-07-18 06:05:17 EDT
An app might want to prevent a lockArea from being loaded by
a user different from the one that created it originally.
The LockArea class itself already supports this by saving
the userID along with the locks. We need to add the following
check, or (more likely) some mechanism that allows the following
check to be invoked:

String userID = lockArea.getUserID();
if (userID != null && !userID.equals(session.getUserID())
{
  throw new SecurityEx("Yada yada");
}
Comment 1 Caspar D. CLA 2011-07-18 06:16:56 EDT
Ideas from our Skype discussion:

interface DurableViewHandler {
  void openingView();
  void openedView();
  void closedView();
}

Invoke openingView from within LockManager.openView.

But where to add #addDurableViewHandler(..) ?

On a new interface IRWDurableLockManager which derives from
IDurableLockingManager...
Comment 2 Caspar D. CLA 2011-09-21 05:13:32 EDT
Created attachment 203741 [details]
Patch v1
Comment 3 Eike Stepper CLA 2011-09-22 05:07:07 EDT
Created attachment 203825 [details]
Patch v2

I've moved common.locks.IDurableLockingManager to server.ILockingManager and added a new getter to IRepository. Please let me know what you think about my changes.
Comment 4 Caspar D. CLA 2011-09-26 00:28:28 EDT
Included a slight change to ConcurrentArray, formerly known
as FastList.

Committed revision 9266.
Comment 5 Eike Stepper CLA 2011-11-06 04:59:55 EST
Reopening to fix failure of testDurableViewHandler() if repo is restarted...
Comment 6 Eike Stepper CLA 2011-11-06 05:01:42 EST
Adding:

  public DurableViewHandler[] getDurableViewHandlers()
  {
    return durableViewHandlers.get();
  }
Comment 7 Eike Stepper CLA 2011-11-06 05:02:35 EST
Fixing test:

public class LockingManagerRestartRepositoryTest extends LockingManagerRestartSessionTest
{
  protected void doBetweenSessionCloseAndOpen()
  {
    DurableViewHandler[] handlers = getRepository().getLockingManager().getDurableViewHandlers();
    restartRepository();

    for (DurableViewHandler handler : handlers)
    {
      getRepository().getLockingManager().addDurableViewHandler(handler);
    }
  }
}
Comment 8 Eike Stepper CLA 2012-09-21 07:16:41 EDT
Closing.