blob: 886800f40a261edcb70c7ed14de9d17420cc1f92 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_65) on Tue Feb 25 18:15:49 EST 2014 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
CachingRealm (Apache Shiro 1.2.3 API)
</TITLE>
<META NAME="date" CONTENT="2014-02-25">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CachingRealm (Apache Shiro 1.2.3 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CachingRealm.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/shiro/realm/AuthorizingRealm.html" title="class in org.apache.shiro.realm"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/shiro/realm/CachingRealm.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="CachingRealm.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.shiro.realm</FONT>
<BR>
Class CachingRealm</H2>
<PRE>
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.shiro.realm.CachingRealm</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../org/apache/shiro/authc/LogoutAware.html" title="interface in org.apache.shiro.authc">LogoutAware</A>, <A HREF="../../../../org/apache/shiro/cache/CacheManagerAware.html" title="interface in org.apache.shiro.cache">CacheManagerAware</A>, <A HREF="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm">Realm</A>, <A HREF="../../../../org/apache/shiro/util/Nameable.html" title="interface in org.apache.shiro.util">Nameable</A></DD>
</DL>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../org/apache/shiro/realm/AuthenticatingRealm.html" title="class in org.apache.shiro.realm">AuthenticatingRealm</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public abstract class <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.48"><B>CachingRealm</B></A><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A><DT>implements <A HREF="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm">Realm</A>, <A HREF="../../../../org/apache/shiro/util/Nameable.html" title="interface in org.apache.shiro.util">Nameable</A>, <A HREF="../../../../org/apache/shiro/cache/CacheManagerAware.html" title="interface in org.apache.shiro.cache">CacheManagerAware</A>, <A HREF="../../../../org/apache/shiro/authc/LogoutAware.html" title="interface in org.apache.shiro.authc">LogoutAware</A></DL>
</PRE>
<P>
A very basic abstract extension point for the <A HREF="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm"><CODE>Realm</CODE></A> interface that provides caching support for subclasses.
<p/>
It also provides a convenience method,
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)"><CODE>getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)</CODE></A>, which is useful across all
realm subclasses for obtaining a realm-specific principal/identity.
<p/>
All actual Realm method implementations are left to subclasses.
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>0.9</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#clearCache(org.apache.shiro.subject.PrincipalCollection)"><CODE>clearCache(org.apache.shiro.subject.PrincipalCollection)</CODE></A>,
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#onLogout(org.apache.shiro.subject.PrincipalCollection)"><CODE>onLogout(org.apache.shiro.subject.PrincipalCollection)</CODE></A>,
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)"><CODE>getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)</CODE></A></DL>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#CachingRealm()">CachingRealm</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default no-argument constructor that defaults
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#isCachingEnabled()"><CODE>cachingEnabled</CODE></A> (for general caching) to <code>true</code> and sets a
default <A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#getName()"><CODE>name</CODE></A> based on the class name.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#afterCacheManagerSet()">afterCacheManagerSet</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Template method that may be implemented by subclasses should they wish to react to a
<A HREF="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache"><CODE>CacheManager</CODE></A> instance being set on the realm instance via the
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#setCacheManager(org.apache.shiro.cache.CacheManager)"><CODE>setCacheManager(org.apache.shiro.cache.CacheManager)</CODE></A> mutator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#clearCache(org.apache.shiro.subject.PrincipalCollection)">clearCache</A></B>(<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A>&nbsp;principals)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears out any cached data associated with the specified account identity/identities.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#doClearCache(org.apache.shiro.subject.PrincipalCollection)">doClearCache</A></B>(<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A>&nbsp;principals)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This implementation does nothing - it is a template to be overridden by subclasses if necessary.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)">getAvailablePrincipal</A></B>(<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A>&nbsp;principals)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A utility method for subclasses that returns the first available principal of interest to this particular realm.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache">CacheManager</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#getCacheManager()">getCacheManager</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the <tt>CacheManager</tt> used for data caching to reduce EIS round trips, or <tt>null</tt> if
caching is disabled.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#getName()">getName</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the (application-unique) name assigned to this <code>Realm</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#isCachingEnabled()">isCachingEnabled</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns <code>true</code> if caching should be used if a <A HREF="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache"><CODE>CacheManager</CODE></A> has been
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#setCacheManager(org.apache.shiro.cache.CacheManager)"><CODE>configured</CODE></A>, <code>false</code> otherwise.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#onLogout(org.apache.shiro.subject.PrincipalCollection)">onLogout</A></B>(<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A>&nbsp;principals)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If caching is enabled, this will clear any cached data associated with the specified account identity.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#setCacheManager(org.apache.shiro.cache.CacheManager)">setCacheManager</A></B>(<A HREF="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache">CacheManager</A>&nbsp;cacheManager)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the <tt>CacheManager</tt> to be used for data caching to reduce EIS round trips.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#setCachingEnabled(boolean)">setCachingEnabled</A></B>(boolean&nbsp;cachingEnabled)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets whether or not caching should be used if a <A HREF="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache"><CODE>CacheManager</CODE></A> has been
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#setCacheManager(org.apache.shiro.cache.CacheManager)"><CODE>configured</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#setName(java.lang.String)">setName</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;name)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the (preferably application unique) name for this component.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_org.apache.shiro.realm.Realm"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from interface org.apache.shiro.realm.<A HREF="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm">Realm</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../org/apache/shiro/realm/Realm.html#getAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken)">getAuthenticationInfo</A>, <A HREF="../../../../org/apache/shiro/realm/Realm.html#supports(org.apache.shiro.authc.AuthenticationToken)">supports</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="CachingRealm()"><!-- --></A><H3>
CachingRealm</H3>
<PRE>
public <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.71"><B>CachingRealm</B></A>()</PRE>
<DL>
<DD>Default no-argument constructor that defaults
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#isCachingEnabled()"><CODE>cachingEnabled</CODE></A> (for general caching) to <code>true</code> and sets a
default <A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#getName()"><CODE>name</CODE></A> based on the class name.
<p/>
Note that while in general, caching may be enabled by default, subclasses have control over
if specific caching is enabled.
<P>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="getCacheManager()"><!-- --></A><H3>
getCacheManager</H3>
<PRE>
public <A HREF="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache">CacheManager</A> <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.83"><B>getCacheManager</B></A>()</PRE>
<DL>
<DD>Returns the <tt>CacheManager</tt> used for data caching to reduce EIS round trips, or <tt>null</tt> if
caching is disabled.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the <tt>CacheManager</tt> used for data caching to reduce EIS round trips, or <tt>null</tt> if
caching is disabled.</DL>
</DD>
</DL>
<HR>
<A NAME="setCacheManager(org.apache.shiro.cache.CacheManager)"><!-- --></A><H3>
setCacheManager</H3>
<PRE>
public void <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.94"><B>setCacheManager</B></A>(<A HREF="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache">CacheManager</A>&nbsp;cacheManager)</PRE>
<DL>
<DD>Sets the <tt>CacheManager</tt> to be used for data caching to reduce EIS round trips.
<p/>
This property is <tt>null</tt> by default, indicating that caching is turned off.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/apache/shiro/cache/CacheManagerAware.html#setCacheManager(org.apache.shiro.cache.CacheManager)">setCacheManager</A></CODE> in interface <CODE><A HREF="../../../../org/apache/shiro/cache/CacheManagerAware.html" title="interface in org.apache.shiro.cache">CacheManagerAware</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>cacheManager</CODE> - the <tt>CacheManager</tt> to use for data caching, or <tt>null</tt> to disable caching.</DL>
</DD>
</DL>
<HR>
<A NAME="isCachingEnabled()"><!-- --></A><H3>
isCachingEnabled</H3>
<PRE>
public boolean <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.110"><B>isCachingEnabled</B></A>()</PRE>
<DL>
<DD>Returns <code>true</code> if caching should be used if a <A HREF="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache"><CODE>CacheManager</CODE></A> has been
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#setCacheManager(org.apache.shiro.cache.CacheManager)"><CODE>configured</CODE></A>, <code>false</code> otherwise.
<p/>
The default value is <code>true</code> since the large majority of Realms will benefit from caching if a CacheManager
has been configured. However, memory-only realms should set this value to <code>false</code> since they would
manage account data in memory already lookups would already be as efficient as possible.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if caching will be globally enabled if a <A HREF="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache"><CODE>CacheManager</CODE></A> has been
configured, <code>false</code> otherwise</DL>
</DD>
</DL>
<HR>
<A NAME="setCachingEnabled(boolean)"><!-- --></A><H3>
setCachingEnabled</H3>
<PRE>
public void <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.120"><B>setCachingEnabled</B></A>(boolean&nbsp;cachingEnabled)</PRE>
<DL>
<DD>Sets whether or not caching should be used if a <A HREF="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache"><CODE>CacheManager</CODE></A> has been
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#setCacheManager(org.apache.shiro.cache.CacheManager)"><CODE>configured</CODE></A>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>cachingEnabled</CODE> - whether or not to globally enable caching for this realm.</DL>
</DD>
</DL>
<HR>
<A NAME="getName()"><!-- --></A><H3>
getName</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.124"><B>getName</B></A>()</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../org/apache/shiro/realm/Realm.html#getName()">Realm</A></CODE></B></DD>
<DD>Returns the (application-unique) name assigned to this <code>Realm</code>. All realms configured for a single
application must have a unique name.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/apache/shiro/realm/Realm.html#getName()">getName</A></CODE> in interface <CODE><A HREF="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm">Realm</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the (application-unique) name assigned to this <code>Realm</code>.</DL>
</DD>
</DL>
<HR>
<A NAME="setName(java.lang.String)"><!-- --></A><H3>
setName</H3>
<PRE>
public void <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.128"><B>setName</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;name)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../org/apache/shiro/util/Nameable.html#setName(java.lang.String)">Nameable</A></CODE></B></DD>
<DD>Sets the (preferably application unique) name for this component.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/apache/shiro/util/Nameable.html#setName(java.lang.String)">setName</A></CODE> in interface <CODE><A HREF="../../../../org/apache/shiro/util/Nameable.html" title="interface in org.apache.shiro.util">Nameable</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the preferably application unique name for this component.</DL>
</DD>
</DL>
<HR>
<A NAME="afterCacheManagerSet()"><!-- --></A><H3>
afterCacheManagerSet</H3>
<PRE>
protected void <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.137"><B>afterCacheManagerSet</B></A>()</PRE>
<DL>
<DD>Template method that may be implemented by subclasses should they wish to react to a
<A HREF="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache"><CODE>CacheManager</CODE></A> instance being set on the realm instance via the
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#setCacheManager(org.apache.shiro.cache.CacheManager)"><CODE>setCacheManager(org.apache.shiro.cache.CacheManager)</CODE></A> mutator.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="onLogout(org.apache.shiro.subject.PrincipalCollection)"><!-- --></A><H3>
onLogout</H3>
<PRE>
public void <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.151"><B>onLogout</B></A>(<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A>&nbsp;principals)</PRE>
<DL>
<DD>If caching is enabled, this will clear any cached data associated with the specified account identity.
Subclasses are free to override for additional behavior, but be sure to call <code>super.onLogout</code> first.
<p/>
This default implementation merely calls <A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#clearCache(org.apache.shiro.subject.PrincipalCollection)"><CODE>clearCache(org.apache.shiro.subject.PrincipalCollection)</CODE></A>.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/apache/shiro/authc/LogoutAware.html#onLogout(org.apache.shiro.subject.PrincipalCollection)">onLogout</A></CODE> in interface <CODE><A HREF="../../../../org/apache/shiro/authc/LogoutAware.html" title="interface in org.apache.shiro.authc">LogoutAware</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>principals</CODE> - the application-specific Subject/user identifier that is logging out.<DT><B>Since:</B></DT>
<DD>1.2</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#clearCache(org.apache.shiro.subject.PrincipalCollection)"><CODE>clearCache(org.apache.shiro.subject.PrincipalCollection)</CODE></A>,
<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)"><CODE>getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="clearCache(org.apache.shiro.subject.PrincipalCollection)"><!-- --></A><H3>
clearCache</H3>
<PRE>
protected void <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.164"><B>clearCache</B></A>(<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A>&nbsp;principals)</PRE>
<DL>
<DD>Clears out any cached data associated with the specified account identity/identities.
<p/>
This implementation will return quietly if the principals argument is null or empty. Otherwise it delegates
to <A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#doClearCache(org.apache.shiro.subject.PrincipalCollection)"><CODE>doClearCache(org.apache.shiro.subject.PrincipalCollection)</CODE></A>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>principals</CODE> - the principals of the account for which to clear any cached data.<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="doClearCache(org.apache.shiro.subject.PrincipalCollection)"><!-- --></A><H3>
doClearCache</H3>
<PRE>
protected void <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.177"><B>doClearCache</B></A>(<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A>&nbsp;principals)</PRE>
<DL>
<DD>This implementation does nothing - it is a template to be overridden by subclasses if necessary.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>principals</CODE> - principals the principals of the account for which to clear any cached data.<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)"><!-- --></A><H3>
getAvailablePrincipal</H3>
<PRE>
protected <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> <A HREF="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.198"><B>getAvailablePrincipal</B></A>(<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A>&nbsp;principals)</PRE>
<DL>
<DD>A utility method for subclasses that returns the first available principal of interest to this particular realm.
The heuristic used to acquire the principal is as follows:
<ul>
<li>Attempt to get <em>this particular Realm's</em> 'primary' principal in the <code>PrincipalCollection</code> via a
<code>principals.<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html#fromRealm(java.lang.String)"><CODE>fromRealm</CODE></A>(<A HREF="../../../../org/apache/shiro/realm/CachingRealm.html#getName()"><CODE>getName()</CODE></A>)</code>
call.</li>
<li>If the previous call does not result in any principals, attempt to get the overall 'primary' principal
from the PrincipalCollection via <A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html#getPrimaryPrincipal()"><CODE>PrincipalCollection.getPrimaryPrincipal()</CODE></A>.</li>
<li>If there are no principals from that call (or the PrincipalCollection argument was null to begin with),
return <code>null</code></li>
</ul>
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>principals</CODE> - the PrincipalCollection holding all principals (from all realms) associated with a single Subject.
<DT><B>Returns:</B><DD>the 'primary' principal attributed to this particular realm, or the fallback 'master' principal if it
exists, or if not <code>null</code>.<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CachingRealm.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/shiro/realm/AuthorizingRealm.html" title="class in org.apache.shiro.realm"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/shiro/realm/CachingRealm.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="CachingRealm.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright &#169; 2004-2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>