/** @ADDED */
 @Override
 protected void validateDefinition() {
   CheckUtil.checkState(
       eIsSet(CDODefsPackage.EPACKAGE_DEF__NS_URI) //
           && URI.create(getNsURI()) != null,
       "nsURI not set or invalid!");
 }
Exemple #2
0
  public static InternalView openViewWithLockArea(
      InternalSession session,
      InternalLockManager lockManager,
      CDOBranch viewedBranch,
      String lockAreaID) {
    LockArea lockArea;
    InternalView view;

    try {
      lockArea = lockManager.getLockArea(lockAreaID);

      // If we get here, the lockArea already exists.
      view =
          (InternalView)
              lockManager.openView(session, InternalSession.TEMP_VIEW_ID, true, lockAreaID);
    } catch (LockAreaNotFoundException e) {
      // If we get here, the lockArea does not yet exist, so we open
      // a view without a lockArea first, then create a lockArea with the given ID,
      // and associate it with the view.
      view = session.openView(InternalSession.TEMP_VIEW_ID, viewedBranch.getHead());
      lockArea = lockManager.createLockArea(view, lockAreaID);
      view.setDurableLockingID(lockAreaID);
    }

    CheckUtil.checkNull(lockAreaID, "lockAreaID");
    CheckUtil.checkNull(lockArea, "lockArea");
    CheckUtil.checkState(
        lockAreaID.equals(lockArea.getDurableLockingID()), "lockAreaID has incorrect value");

    return view;
  }