blob: 507b66f303e58ed8e9473098b625a51dcd65ca0b [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>EJBContext</title>
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
<link rel="shortcut icon" href="/img/jakarta-favicon.ico">
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="EJBContext";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":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="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="../../jakarta/ejb/EJBAccessException.html" title="class in jakarta.ejb"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../jakarta/ejb/EJBException.html" title="class in jakarta.ejb"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?jakarta/ejb/EJBContext.html" target="_top">Frames</a></li>
<li><a href="EJBContext.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">jakarta.ejb</div>
<h2 title="Interface EJBContext" class="title">Interface EJBContext</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><a href="../../jakarta/ejb/EntityContext.html" title="interface in jakarta.ejb">EntityContext</a>, <a href="../../jakarta/ejb/MessageDrivenContext.html" title="interface in jakarta.ejb">MessageDrivenContext</a>, <a href="../../jakarta/ejb/SessionContext.html" title="interface in jakarta.ejb">SessionContext</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">EJBContext</span></pre>
<div class="block">The EJBContext interface provides an instance with access to the container-provided runtime context of an enterprise
bean instance.
<p>
This interface is extended by the <code>SessionContext</code>, <code>EntityContext</code>, and
<code>MessageDrivenContext</code> interfaces to provide additional methods specific to the enterprise interface bean
type.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>EJB 1.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../jakarta/ejb/SessionContext.html" title="interface in jakarta.ejb"><code>SessionContext</code></a>,
<a href="../../jakarta/ejb/MessageDrivenContext.html" title="interface in jakarta.ejb"><code>MessageDrivenContext</code></a>,
<a href="../../jakarta/ejb/EntityContext.html" title="interface in jakarta.ejb"><code>EntityContext</code></a></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>java.security.Principal</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/ejb/EJBContext.html#getCallerPrincipal--">getCallerPrincipal</a></span>()</code>
<div class="block">Obtain the <code>java.security.Principal</code> that identifies the caller.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>java.util.Map&lt;java.lang.String,java.lang.Object&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/ejb/EJBContext.html#getContextData--">getContextData</a></span>()</code>
<div class="block">The <code>getContextData</code> method enables a business method, lifecycle callback method, or timeout method to
retrieve any interceptor/webservices context associated with its invocation.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/ejb/EJBHome.html" title="interface in jakarta.ejb">EJBHome</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/ejb/EJBContext.html#getEJBHome--">getEJBHome</a></span>()</code>
<div class="block">Obtain the enterprise bean's remote home interface.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/ejb/EJBLocalHome.html" title="interface in jakarta.ejb">EJBLocalHome</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/ejb/EJBContext.html#getEJBLocalHome--">getEJBLocalHome</a></span>()</code>
<div class="block">Obtain the enterprise bean's local home interface.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/ejb/EJBContext.html#getRollbackOnly--">getRollbackOnly</a></span>()</code>
<div class="block">Test if the transaction has been marked for rollback only.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/ejb/TimerService.html" title="interface in jakarta.ejb">TimerService</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/ejb/EJBContext.html#getTimerService--">getTimerService</a></span>()</code>
<div class="block">Get access to the enterprise bean Timer Service.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/transaction/UserTransaction.html" title="interface in jakarta.transaction">UserTransaction</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/ejb/EJBContext.html#getUserTransaction--">getUserTransaction</a></span>()</code>
<div class="block">Obtain the transaction demarcation interface.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/ejb/EJBContext.html#isCallerInRole-java.lang.String-">isCallerInRole</a></span>(java.lang.String&nbsp;roleName)</code>
<div class="block">Test if the caller has a given security role.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/ejb/EJBContext.html#lookup-java.lang.String-">lookup</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Lookup a resource within the <code>java:</code> namespace.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/ejb/EJBContext.html#setRollbackOnly--">setRollbackOnly</a></span>()</code>
<div class="block">Mark the current transaction for rollback.</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="getEJBHome--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEJBHome</h4>
<pre><a href="../../jakarta/ejb/EJBHome.html" title="interface in jakarta.ejb">EJBHome</a>&nbsp;getEJBHome()
throws java.lang.IllegalStateException</pre>
<div class="block">Obtain the enterprise bean's remote home interface.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The enterprise bean's remote home interface.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if the enterprise bean does not have a remote home interface.</dd>
</dl>
</li>
</ul>
<a name="getEJBLocalHome--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEJBLocalHome</h4>
<pre><a href="../../jakarta/ejb/EJBLocalHome.html" title="interface in jakarta.ejb">EJBLocalHome</a>&nbsp;getEJBLocalHome()
throws java.lang.IllegalStateException</pre>
<div class="block">Obtain the enterprise bean's local home interface.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The enterprise bean's local home interface.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if the enterprise bean does not have a local home interface.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>EJB 2.0</dd>
</dl>
</li>
</ul>
<a name="getCallerPrincipal--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCallerPrincipal</h4>
<pre>java.security.Principal&nbsp;getCallerPrincipal()
throws java.lang.IllegalStateException</pre>
<div class="block">Obtain the <code>java.security.Principal</code> that identifies the caller.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The <code>Principal</code> object that identifies the caller. This method never returns <code>null</code>.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - The Container throws the exception if the instance is not allowed to call this
method.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>EJB 1.1</dd>
</dl>
</li>
</ul>
<a name="isCallerInRole-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isCallerInRole</h4>
<pre>boolean&nbsp;isCallerInRole(java.lang.String&nbsp;roleName)
throws java.lang.IllegalStateException</pre>
<div class="block">Test if the caller has a given security role.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>roleName</code> - The name of the security role. The role must be one of the security roles that is defined in the
deployment descriptor.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>True if the caller has the specified role.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - The Container throws the exception if the instance is not allowed to call this
method.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>EJB 1.1</dd>
</dl>
</li>
</ul>
<a name="getUserTransaction--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUserTransaction</h4>
<pre><a href="../../jakarta/transaction/UserTransaction.html" title="interface in jakarta.transaction">UserTransaction</a>&nbsp;getUserTransaction()
throws java.lang.IllegalStateException</pre>
<div class="block">Obtain the transaction demarcation interface.
Only enterprise beans with bean-managed transactions are allowed to to use the <code>UserTransaction</code>
interface. As entity beans must always use container-managed transactions, only session beans or message-driven beans
with bean-managed transactions are allowed to invoke this method.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The <code>UserTransaction</code> interface that the enterprise bean instance can use for transaction
demarcation.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - The Container throws the exception if the instance is not allowed to use the
<code>UserTransaction</code> interface (i.e. the instance is of a bean with container-managed transactions).</dd>
</dl>
</li>
</ul>
<a name="setRollbackOnly--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setRollbackOnly</h4>
<pre>void&nbsp;setRollbackOnly()
throws java.lang.IllegalStateException</pre>
<div class="block">Mark the current transaction for rollback. The transaction will become permanently marked for rollback. A transaction
marked for rollback can never commit.
Only enterprise beans with container-managed transactions are allowed to use this method.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - The Container throws the exception if the instance is not allowed to use this method
(i.e. the instance is of a bean with bean-managed transactions).</dd>
</dl>
</li>
</ul>
<a name="getRollbackOnly--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRollbackOnly</h4>
<pre>boolean&nbsp;getRollbackOnly()
throws java.lang.IllegalStateException</pre>
<div class="block">Test if the transaction has been marked for rollback only. An enterprise bean instance can use this operation, for
example, to test after an exception has been caught, whether it is fruitless to continue computation on behalf of the
current transaction.
Only enterprise beans with container-managed transactions are allowed to use this method.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>True if the current transaction is marked for rollback, false otherwise.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - The Container throws the exception if the instance is not allowed to use this method
(i.e. the instance is of a bean with bean-managed transactions).</dd>
</dl>
</li>
</ul>
<a name="getTimerService--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTimerService</h4>
<pre><a href="../../jakarta/ejb/TimerService.html" title="interface in jakarta.ejb">TimerService</a>&nbsp;getTimerService()
throws java.lang.IllegalStateException</pre>
<div class="block">Get access to the enterprise bean Timer Service.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a <a href="../../jakarta/ejb/TimerService.html" title="interface in jakarta.ejb"><code>TimerService</code></a> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - The Container throws the exception if the instance is not allowed to use this method
(e.g. if the bean is a stateful session bean)</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>EJB 2.1</dd>
</dl>
</li>
</ul>
<a name="lookup-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>lookup</h4>
<pre>java.lang.Object&nbsp;lookup(java.lang.String&nbsp;name)
throws java.lang.IllegalArgumentException</pre>
<div class="block">Lookup a resource within the <code>java:</code> namespace. Names referring to entries within the private component
namespace can be passed as unqualified strings. In that case the lookup will be relative to
<code>"java:comp/env/"</code>.
For example, assuming an enterprise bean defines an <code>ejb-local-ref</code> with <code>ejb-ref-name</code>
<code>"ejb/BarRef"</code> the following two calls to <code> EJBContext.lookup</code> are equivalent :
<code>ejbContext.lookup("ejb/BarRef")</code>; <code>ejbContext.lookup("java:comp/env/ejb/BarRef")</code>;</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - Name of the entry</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a <code>Object</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - The Container throws the exception if the given name does not match an entry
within the component's environment.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>EJB 3.0</dd>
</dl>
</li>
</ul>
<a name="getContextData--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getContextData</h4>
<pre>java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;getContextData()</pre>
<div class="block">The <code>getContextData</code> method enables a business method, lifecycle callback method, or timeout method to
retrieve any interceptor/webservices context associated with its invocation.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the context data that interceptor context associated with this invocation. If there is no context data, an
empty <code>Map&#060;String,Object&#062;</code> object will be returned.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>EJB 3.1</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="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="../../jakarta/ejb/EJBAccessException.html" title="class in jakarta.ejb"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../jakarta/ejb/EJBException.html" title="class in jakarta.ejb"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?jakarta/ejb/EJBContext.html" target="_top">Frames</a></li>
<li><a href="EJBContext.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 ======= -->
</body>
</html>