Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-28799

Remove "session id" notion from CoreSession and DocumentModel

    XMLWordPrintable

    Details

    • Type: Clean up
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11.1, 2021.0
    • Component/s: Core
    • Impact type:
      API change
    • Upgrade notes:
      Hide

      New methods:

      • DocumentModel.getPrincipal()
      • DocumentModel.attach(CoreSession)
      • DocumentModel.isAttached()
      • CoreInstance.getCoreSession() various signatures, as replacements for deprecated openCoreSession()
      • CoreInstance.getCoreSessionSystem() various signatures, as replacements for deprecated openCoreSessionSystem()

      Deprecated methods/fields/classes:

      • DocumentModel.getSessionId()
      • DocumentModel() constructors with sid parameter
      • CoreInstance.openCoreSession() various signatures (use getCoreSession() instead)
      • CoreInstance.openCoreSessionSystem() various signatures (use getCoreSessionSystem() instead)
      • CoreInstance.closeCoreSession() (does nothing)
      • DocumentModelFactory.createDocumentModel(type, id) (was unused)
      • CoreEventConstants.SESSION_ID (was unused for a long time)
      • CoreSessionService.releaseCoreSession(CoreSession) (does nothing)
      • CloseableCoreSession (use CoreSession instead)

      New INTERNAL methods:

      • DocumentModel() constructor with CoreSession, repositoryName, NuxeoPrincipal parameters
      • DocumentModelFactory.createDocumentModel() signatures with CoreSession parameter
      • BaseSession.createEntryModel(schema, id, values, readOnly) and variations (directory class)

      Removed methods/fields/classes (these were INTERNAL implementation details):

      • DocumentModel.attach(sid)
      • DocumentModelFactory.createDocumentModel() signatures with sid parameter
      • CoreSession.isLive(boolean)
      • CoreSession.getSessionId()
      • CoreInstance.getSession(sid)
      • CoreSessionService.getCoreSession(sid)
      • CoreSessionService.getCoreSessionRegistrationInfos()
      • BaseSession.createEntryModel() signatures with sid parameter (directory class)
      • LocalException (DocumentNotFoundException is thrown instead)
      • CoreSessionRegistrationInfo
      • SessionInfo
      • SIDGenerator
      Show
      New methods: DocumentModel.getPrincipal() DocumentModel.attach(CoreSession) DocumentModel.isAttached() CoreInstance.getCoreSession() various signatures, as replacements for deprecated openCoreSession() CoreInstance.getCoreSessionSystem() various signatures, as replacements for deprecated openCoreSessionSystem() Deprecated methods/fields/classes: DocumentModel.getSessionId() DocumentModel() constructors with sid parameter CoreInstance.openCoreSession() various signatures (use getCoreSession() instead) CoreInstance.openCoreSessionSystem() various signatures (use getCoreSessionSystem() instead) CoreInstance.closeCoreSession() (does nothing) DocumentModelFactory.createDocumentModel(type, id) (was unused) CoreEventConstants.SESSION_ID (was unused for a long time) CoreSessionService.releaseCoreSession(CoreSession) (does nothing) CloseableCoreSession (use CoreSession instead) New INTERNAL methods: DocumentModel() constructor with CoreSession, repositoryName, NuxeoPrincipal parameters DocumentModelFactory.createDocumentModel() signatures with CoreSession parameter BaseSession.createEntryModel(schema, id, values, readOnly) and variations (directory class) Removed methods/fields/classes (these were INTERNAL implementation details): DocumentModel.attach(sid) DocumentModelFactory.createDocumentModel() signatures with sid parameter CoreSession.isLive(boolean) CoreSession.getSessionId() CoreInstance.getSession(sid) CoreSessionService.getCoreSession(sid) CoreSessionService.getCoreSessionRegistrationInfos() BaseSession.createEntryModel() signatures with sid parameter (directory class) LocalException ( DocumentNotFoundException is thrown instead) CoreSessionRegistrationInfo SessionInfo SIDGenerator
    • Team:
      FG
    • Sprint:
      nxFG 11.1.13
    • Story Points:
      5

      Description

      CoreSession and DocumentModel have a notion of a "session id" that is used to reattach documents after they have been detached. This is actually a remnant of very old code when Nuxeo was using EJBs, but is not needed anymore.

      To clean this up, we make CoreSession a lightweight object that just holds a reference to the repository name and principal it concerns. Creating one is cheap, and it doesn't hold any intrinsic resources, so there is no need for the complex caching and closing mechanism we still have today (resources are held by the Session layer which has its own pool and life cycle).

      The fact that a DocumentModel can be detached and reattached to a new session just means that potentially it can refer to a different principal to do security checks through a session. But if has a principal then it's always possible to get a CoreSession and therefore view it as "attached".

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 days
                  3d