Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352330 - Make lockArea loading vetoable
Summary: Make lockArea loading vetoable
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Caspar D. CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on: 351793
Blocks:
  Show dependency tree
 
Reported: 2011-07-18 06:05 EDT by Caspar D. CLA
Modified: 2012-09-21 07:16 EDT (History)
1 user (show)

See Also:
stepper: review+


Attachments
Patch v1 (7.76 KB, patch)
2011-09-21 05:13 EDT, Caspar D. CLA
no flags Details | Diff
Patch v2 (49.40 KB, patch)
2011-09-22 05:07 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 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.