Class MCRSession

java.lang.Object
org.mycore.common.MCRSession
All Implemented Interfaces:
Cloneable

public class MCRSession extends Object implements Cloneable
Instances of this class collect information kept during a session like the currently active user, the preferred language etc.
Version:
$Revision$ $Date$
Author:
Detlev Degenhardt, Jens Kupferschmidt, Frank Lützenkirchen
  • Method Details

    • setLoginTime

      protected final void setLoginTime()
    • getID

      public String getID()
      Returns the unique ID of this session
    • getObjectsKeyList

      public Iterator<Object> getObjectsKeyList()
      Returns a list of all stored object keys within MCRSession. This method is not thread safe. I you need thread safe access to all stored objects use getMapEntries() instead.
      Returns:
      Returns a list of all stored object keys within MCRSession as java.util.Ierator
    • getMapEntries

      public List<Map.Entry<Object,Object>> getMapEntries()
      Returns an unmodifiable list of all entries in this MCRSession This method is thread safe.
    • getCurrentLanguage

      public final String getCurrentLanguage()
      returns the current language
    • setCurrentLanguage

      public final void setCurrentLanguage(String language)
      sets the current language
    • getLocale

      public Locale getLocale()
    • debug

      public final void debug()
      Write data to the logger for debugging purposes
    • put

      public Object put(Object key, Object value)
      Stores an object under the given key within the session *
    • get

      public Object get(Object key)
      Returns the object that was stored in the session under the given key *
    • deleteObject

      public void deleteObject(Object key)
    • getCurrentIP

      public String getCurrentIP()
      Get the current ip value
    • setCurrentIP

      public final void setCurrentIP(String newip)
      Set the ip to the given IP
    • getLoginTime

      public final long getLoginTime()
    • close

      public void close()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLastAccessedTime

      public long getLastAccessedTime()
    • setFirstURI

      public void setFirstURI(Supplier<URI> uri)
    • getThisAccessTime

      public long getThisAccessTime()
    • getCreateTime

      public long getCreateTime()
    • beginTransaction

      @Deprecated public void beginTransaction()
      Deprecated.
      starts a new database transaction.
    • transactionRequiresRollback

      @Deprecated public boolean transactionRequiresRollback()
      Deprecated.
      Determine whether the current resource transaction has been marked for rollback.
      Returns:
      boolean indicating whether the transaction has been marked for rollback
    • commitTransaction

      @Deprecated public void commitTransaction()
      Deprecated.
      commits the database transaction. Commit is only done if isTransactionActive() returns true.
    • rollbackTransaction

      @Deprecated public void rollbackTransaction()
      Deprecated.
      forces the database transaction to roll back. Roll back is only performed if isTransactionActive() returns true.
    • isTransactionActive

      @Deprecated public boolean isTransactionActive()
      Deprecated.
      Is the transaction still alive?
      Returns:
      true if the transaction is still alive
    • getConstructingStackTrace

      public StackTraceElement[] getConstructingStackTrace()
    • getFirstURI

      public Optional<URI> getFirstURI()
    • getUserInformation

      public MCRUserInformation getUserInformation()
      Returns:
      the userInformation
    • setUserInformation

      public void setUserInformation(MCRUserInformation userSystemAdapter)
      Parameters:
      userSystemAdapter - the userInformation to set
      Throws:
      IllegalArgumentException - if transition to new user information is forbidden (privilege escalation)
    • onCommit

      public void onCommit(Runnable task)
      Add a task which will be executed after commitTransaction() was called.
      Parameters:
      task - thread witch will be executed after an commit
    • submitOnCommitTasks

      protected void submitOnCommitTasks()