| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="fr"> |
| <head> |
| <!-- Generated by javadoc (11.0.4) on Fri Jan 24 17:07:14 CET 2020 --> |
| <title>SessionDAO (Apache Shiro 1.5.0 API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2020-01-24"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../jquery/jquery-ui.css" title="Style"> |
| <script type="text/javascript" src="../../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../../../jquery/jquery-3.3.1.js"></script> |
| <script type="text/javascript" src="../../../../../../jquery/jquery-migrate-3.0.1.js"></script> |
| <script type="text/javascript" src="../../../../../../jquery/jquery-ui.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="SessionDAO (Apache Shiro 1.5.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| var pathtoroot = "../../../../../../"; |
| var useModuleDirectories = true; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/SessionDAO.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.apache.shiro.session.mgt.eis</a></div> |
| <h2 title="Interface SessionDAO" class="title">Interface SessionDAO</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Known Implementing Classes:</dt> |
| <dd><code><a href="AbstractSessionDAO.html" title="class in org.apache.shiro.session.mgt.eis">AbstractSessionDAO</a></code>, <code><a href="CachingSessionDAO.html" title="class in org.apache.shiro.session.mgt.eis">CachingSessionDAO</a></code>, <code><a href="EnterpriseCacheSessionDAO.html" title="class in org.apache.shiro.session.mgt.eis">EnterpriseCacheSessionDAO</a></code>, <code><a href="MemorySessionDAO.html" title="class in org.apache.shiro.session.mgt.eis">MemorySessionDAO</a></code></dd> |
| </dl> |
| <hr> |
| <pre>public interface <a href="../../../../../../src-html/org/apache/shiro/session/mgt/eis/SessionDAO.html#line.42">SessionDAO</a></pre> |
| <div class="block">Data Access Object design pattern specification to enable <a href="../../Session.html" title="interface in org.apache.shiro.session"><code>Session</code></a> access to an |
| EIS (Enterprise Information System). It provides your four typical CRUD methods: |
| <a href="#create(org.apache.shiro.session.Session)"><code>create(org.apache.shiro.session.Session)</code></a>, <a href="#readSession(java.io.Serializable)"><code>readSession(java.io.Serializable)</code></a>, <a href="#update(org.apache.shiro.session.Session)"><code>update(org.apache.shiro.session.Session)</code></a>, |
| and <a href="#delete(org.apache.shiro.session.Session)"><code>delete(org.apache.shiro.session.Session)</code></a>. |
| <p/> |
| The remaining <a href="#getActiveSessions()"><code>getActiveSessions()</code></a> method exists as a support mechanism to pre-emptively orphaned sessions, |
| typically by <a href="../ValidatingSessionManager.html" title="interface in org.apache.shiro.session.mgt"><code>ValidatingSessionManager</code></a>s), and should |
| be as efficient as possible, especially if there are thousands of active sessions. Large scale/high performance |
| implementations will often return a subset of the total active sessions and perform validation a little more |
| frequently, rather than return a massive set and infrequently validate.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.1</dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io" class="externalLink">Serializable</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#create(org.apache.shiro.session.Session)">create</a></span>​(<a href="../../Session.html" title="interface in org.apache.shiro.session">Session</a> session)</code></th> |
| <td class="colLast"> |
| <div class="block">Inserts a new Session record into the underling EIS (e.g.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#delete(org.apache.shiro.session.Session)">delete</a></span>​(<a href="../../Session.html" title="interface in org.apache.shiro.session">Session</a> session)</code></th> |
| <td class="colLast"> |
| <div class="block">Deletes the associated EIS record of the specified <code>session</code>.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a><<a href="../../Session.html" title="interface in org.apache.shiro.session">Session</a>></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getActiveSessions()">getActiveSessions</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns all sessions in the EIS that are considered active, meaning all sessions that |
| haven't been stopped/expired.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="../../Session.html" title="interface in org.apache.shiro.session">Session</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#readSession(java.io.Serializable)">readSession</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io" class="externalLink">Serializable</a> sessionId)</code></th> |
| <td class="colLast"> |
| <div class="block">Retrieves the session from the EIS uniquely identified by the specified |
| <code>sessionId</code>.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(org.apache.shiro.session.Session)">update</a></span>​(<a href="../../Session.html" title="interface in org.apache.shiro.session">Session</a> session)</code></th> |
| <td class="colLast"> |
| <div class="block">Updates (persists) data from a previously created Session instance in the EIS identified by |
| <code>{@link Session#getId() session.getId()}</code>.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="create(org.apache.shiro.session.Session)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>create</h4> |
| <pre class="methodSignature"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io" class="externalLink">Serializable</a> <a href="../../../../../../src-html/org/apache/shiro/session/mgt/eis/SessionDAO.html#line.61">create</a>​(<a href="../../Session.html" title="interface in org.apache.shiro.session">Session</a> session)</pre> |
| <div class="block">Inserts a new Session record into the underling EIS (e.g. Relational database, file system, persistent cache, |
| etc, depending on the DAO implementation). |
| <p/> |
| After this method is invoked, the <a href="../../Session.html#getId()"><code>Session.getId()</code></a> |
| method executed on the argument must return a valid session identifier. That is, the following should |
| always be true: |
| <pre> |
| Serializable id = create( session ); |
| id.equals( session.getId() ) == true</pre> |
| <p/> |
| Implementations are free to throw any exceptions that might occur due to |
| integrity violation constraints or other EIS related errors.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>session</code> - the <a href="../../Session.html" title="interface in org.apache.shiro.session"><code>Session</code></a> object to create in the EIS.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the EIS id (e.g. primary key) of the created <code>Session</code> object.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="readSession(java.io.Serializable)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>readSession</h4> |
| <pre class="methodSignature"><a href="../../Session.html" title="interface in org.apache.shiro.session">Session</a> <a href="../../../../../../src-html/org/apache/shiro/session/mgt/eis/SessionDAO.html#line.73">readSession</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io" class="externalLink">Serializable</a> sessionId) |
| throws <a href="../../UnknownSessionException.html" title="class in org.apache.shiro.session">UnknownSessionException</a></pre> |
| <div class="block">Retrieves the session from the EIS uniquely identified by the specified |
| <code>sessionId</code>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>sessionId</code> - the system-wide unique identifier of the Session object to retrieve from |
| the EIS.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the persisted session in the EIS identified by <code>sessionId</code>.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../UnknownSessionException.html" title="class in org.apache.shiro.session">UnknownSessionException</a></code> - if there is no EIS record for any session with the |
| specified <code>sessionId</code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="update(org.apache.shiro.session.Session)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre class="methodSignature">void <a href="../../../../../../src-html/org/apache/shiro/session/mgt/eis/SessionDAO.html#line.89">update</a>​(<a href="../../Session.html" title="interface in org.apache.shiro.session">Session</a> session) |
| throws <a href="../../UnknownSessionException.html" title="class in org.apache.shiro.session">UnknownSessionException</a></pre> |
| <div class="block">Updates (persists) data from a previously created Session instance in the EIS identified by |
| <code>{@link Session#getId() session.getId()}</code>. This effectively propagates |
| the data in the argument to the EIS record previously saved. |
| <p/> |
| In addition to UnknownSessionException, implementations are free to throw any other |
| exceptions that might occur due to integrity violation constraints or other EIS related |
| errors.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>session</code> - the Session to update</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../UnknownSessionException.html" title="class in org.apache.shiro.session">UnknownSessionException</a></code> - if no existing EIS session record exists with the |
| identifier of <a href="../../Session.html#getId()"><code>session.getSessionId()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="delete(org.apache.shiro.session.Session)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>delete</h4> |
| <pre class="methodSignature">void <a href="../../../../../../src-html/org/apache/shiro/session/mgt/eis/SessionDAO.html#line.98">delete</a>​(<a href="../../Session.html" title="interface in org.apache.shiro.session">Session</a> session)</pre> |
| <div class="block">Deletes the associated EIS record of the specified <code>session</code>. If there never |
| existed a session EIS record with the identifier of |
| <a href="../../Session.html#getId()"><code>session.getId()</code></a>, then this method does nothing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>session</code> - the session to delete.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getActiveSessions()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>getActiveSessions</h4> |
| <pre class="methodSignature"><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a><<a href="../../Session.html" title="interface in org.apache.shiro.session">Session</a>> <a href="../../../../../../src-html/org/apache/shiro/session/mgt/eis/SessionDAO.html#line.129">getActiveSessions</a>()</pre> |
| <div class="block">Returns all sessions in the EIS that are considered active, meaning all sessions that |
| haven't been stopped/expired. This is primarily used to validate potential orphans. |
| <p/> |
| If there are no active sessions in the EIS, this method may return an empty collection or <code>null</code>. |
| <h4>Performance</h4> |
| This method should be as efficient as possible, especially in larger systems where there might be |
| thousands of active sessions. Large scale/high performance |
| implementations will often return a subset of the total active sessions and perform validation a little more |
| frequently, rather than return a massive set and validate infrequently. If efficient and possible, it would |
| make sense to return the oldest unstopped sessions available, ordered by |
| <a href="../../Session.html#getLastAccessTime()"><code>lastAccessTime</code></a>. |
| <h4>Smart Results</h4> |
| <em>Ideally</em> this method would only return active sessions that the EIS was certain should be invalided. |
| Typically that is any session that is not stopped and where its lastAccessTimestamp is older than the session |
| timeout. |
| <p/> |
| For example, if sessions were backed by a relational database or SQL-92 'query-able' enterprise cache, you might |
| return something similar to the results returned by this query (assuming |
| <a href="../SimpleSession.html" title="class in org.apache.shiro.session.mgt"><code>SimpleSession</code></a>s were being stored): |
| <pre> |
| select * from sessions s where s.lastAccessTimestamp < ? and s.stopTimestamp is null |
| </pre> |
| where the <code>?</code> parameter is a date instance equal to 'now' minus the session timeout |
| (e.g. now - 30 minutes).</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a Collection of <code>Session</code>s that are considered active, or an |
| empty collection or <code>null</code> if there are no active sessions.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/SessionDAO.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small>Copyright © 2004–2020 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </body> |
| </html> |