blob: c7ddc30f91c59d15758b651c6b68c039a4b01122 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="fr">
<head>
<!-- Generated by javadoc (1.8.0_201) on Sat May 02 22:23:40 CEST 2020 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SessionDAO (Apache Shiro :: Core 1.5.3 API)</title>
<meta name="date" content="2020-05-02">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SessionDAO (Apache Shiro :: Core 1.5.3 API)";
}
}
catch(err) {
}
//-->
var methods = {"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";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.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">
<li><a href="../../../../../../org/apache/shiro/session/mgt/eis/RandomSessionIdGenerator.html" title="class in org.apache.shiro.session.mgt.eis"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../../org/apache/shiro/session/mgt/eis/SessionIdGenerator.html" title="interface in org.apache.shiro.session.mgt.eis"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/shiro/session/mgt/eis/SessionDAO.html" target="_top">Frames</a></li>
<li><a href="SessionDAO.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></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>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.shiro.session.mgt.eis</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><a href="../../../../../../org/apache/shiro/session/mgt/eis/AbstractSessionDAO.html" title="class in org.apache.shiro.session.mgt.eis">AbstractSessionDAO</a>, <a href="../../../../../../org/apache/shiro/session/mgt/eis/CachingSessionDAO.html" title="class in org.apache.shiro.session.mgt.eis">CachingSessionDAO</a>, <a href="../../../../../../org/apache/shiro/session/mgt/eis/EnterpriseCacheSessionDAO.html" title="class in org.apache.shiro.session.mgt.eis">EnterpriseCacheSessionDAO</a>, <a href="../../../../../../org/apache/shiro/session/mgt/eis/MemorySessionDAO.html" title="class in org.apache.shiro.session.mgt.eis">MemorySessionDAO</a></dd>
</dl>
<hr>
<br>
<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="../../../../../../org/apache/shiro/session/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="../../../../../../org/apache/shiro/session/mgt/eis/SessionDAO.html#create-org.apache.shiro.session.Session-"><code>create(org.apache.shiro.session.Session)</code></a>, <a href="../../../../../../org/apache/shiro/session/mgt/eis/SessionDAO.html#readSession-java.io.Serializable-"><code>readSession(java.io.Serializable)</code></a>, <a href="../../../../../../org/apache/shiro/session/mgt/eis/SessionDAO.html#update-org.apache.shiro.session.Session-"><code>update(org.apache.shiro.session.Session)</code></a>,
and <a href="../../../../../../org/apache/shiro/session/mgt/eis/SessionDAO.html#delete-org.apache.shiro.session.Session-"><code>delete(org.apache.shiro.session.Session)</code></a>.
<p/>
The remaining <a href="../../../../../../org/apache/shiro/session/mgt/eis/SessionDAO.html#getActiveSessions--"><code>getActiveSessions()</code></a> method exists as a support mechanism to pre-emptively orphaned sessions,
typically by <a href="../../../../../../org/apache/shiro/session/mgt/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 =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/shiro/session/mgt/eis/SessionDAO.html#create-org.apache.shiro.session.Session-">create</a></span>(<a href="../../../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</a>&nbsp;session)</code>
<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>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/shiro/session/mgt/eis/SessionDAO.html#delete-org.apache.shiro.session.Session-">delete</a></span>(<a href="../../../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</a>&nbsp;session)</code>
<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/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;<a href="../../../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/shiro/session/mgt/eis/SessionDAO.html#getActiveSessions--">getActiveSessions</a></span>()</code>
<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="../../../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/shiro/session/mgt/eis/SessionDAO.html#readSession-java.io.Serializable-">readSession</a></span>(<a href="https://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>&nbsp;sessionId)</code>
<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>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/shiro/session/mgt/eis/SessionDAO.html#update-org.apache.shiro.session.Session-">update</a></span>(<a href="../../../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</a>&nbsp;session)</code>
<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>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="create-org.apache.shiro.session.Session-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>create</h4>
<pre><a href="https://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>&nbsp;<a href="../../../../../../src-html/org/apache/shiro/session/mgt/eis/SessionDAO.html#line.61">create</a>(<a href="../../../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</a>&nbsp;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="../../../../../../org/apache/shiro/session/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="../../../../../../org/apache/shiro/session/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 name="readSession-java.io.Serializable-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readSession</h4>
<pre><a href="../../../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</a>&nbsp;<a href="../../../../../../src-html/org/apache/shiro/session/mgt/eis/SessionDAO.html#line.73">readSession</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>&nbsp;sessionId)
throws <a href="../../../../../../org/apache/shiro/session/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="../../../../../../org/apache/shiro/session/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 name="update-org.apache.shiro.session.Session-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre>void&nbsp;<a href="../../../../../../src-html/org/apache/shiro/session/mgt/eis/SessionDAO.html#line.89">update</a>(<a href="../../../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</a>&nbsp;session)
throws <a href="../../../../../../org/apache/shiro/session/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="../../../../../../org/apache/shiro/session/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="../../../../../../org/apache/shiro/session/Session.html#getId--"><code>session.getSessionId()</code></a></dd>
</dl>
</li>
</ul>
<a name="delete-org.apache.shiro.session.Session-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>delete</h4>
<pre>void&nbsp;<a href="../../../../../../src-html/org/apache/shiro/session/mgt/eis/SessionDAO.html#line.98">delete</a>(<a href="../../../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</a>&nbsp;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="../../../../../../org/apache/shiro/session/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 name="getActiveSessions--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getActiveSessions</h4>
<pre><a href="https://docs.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;<a href="../../../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</a>&gt;&nbsp;<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="../../../../../../org/apache/shiro/session/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="../../../../../../org/apache/shiro/session/mgt/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>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.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">
<li><a href="../../../../../../org/apache/shiro/session/mgt/eis/RandomSessionIdGenerator.html" title="class in org.apache.shiro.session.mgt.eis"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../../org/apache/shiro/session/mgt/eis/SessionIdGenerator.html" title="interface in org.apache.shiro.session.mgt.eis"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/shiro/session/mgt/eis/SessionDAO.html" target="_top">Frames</a></li>
<li><a href="SessionDAO.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All&nbsp;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>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2004&#x2013;2020 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>