blob: c687d29072e259d31a78ab8bd71c968317d6832e [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>InvocationContext</title>
<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="InvocationContext";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":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="../../javax/interceptor/Interceptors.html" title="annotation in javax.interceptor"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/interceptor/InvocationContext.html" target="_top">Frames</a></li>
<li><a href="InvocationContext.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">javax.interceptor</div>
<h2 title="Interface InvocationContext" class="title">Interface InvocationContext</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/openejb/core/interceptor/JaxRpcInvocationContext.html" title="class in org.apache.openejb.core.interceptor">JaxRpcInvocationContext</a>, <a href="../../org/apache/openejb/core/interceptor/JaxWsInvocationContext.html" title="class in org.apache.openejb.core.interceptor">JaxWsInvocationContext</a>, <a href="../../org/apache/openejb/core/interceptor/ReflectionInvocationContext.html" title="class in org.apache.openejb.core.interceptor">ReflectionInvocationContext</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">InvocationContext</span></pre>
<div class="block"><p>
Exposes contextual information about the intercepted invocation and operations that enable interceptor methods to
control the behavior of the invocation chain.
</p>
<pre>
&#064;AroundInvoke
public Object logInvocation(InvocationContext ctx) throws Exception {
String class = ctx.getMethod().getDeclaringClass().getName();
String method = ctx.getMethod().getName();
Logger.global.entering(class, method, ctx.getParameters());
try {
Object result = ctx.proceed();
Logger.global.exiting(class, method, result);
return result;
}
catch (Exception e) {
Logger.global.throwing(class, method, e);
throw e;
}
}
</pre></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Interceptors 1.0</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.lang.reflect.Constructor&lt;?&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/interceptor/InvocationContext.html#getConstructor--">getConstructor</a></span>()</code>
<div class="block">Returns the constructor of the target class for which the <a href="../../javax/interceptor/AroundConstruct.html" title="annotation in javax.interceptor"><code>AroundConstruct</code></a> interceptor method was invoked.</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="../../javax/interceptor/InvocationContext.html#getContextData--">getContextData</a></span>()</code>
<div class="block">Enables an interceptor to retrieve or update the data associated with the invocation by another interceptor, business
method, and/or webservices endpoint in the invocation chain.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.lang.reflect.Method</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/interceptor/InvocationContext.html#getMethod--">getMethod</a></span>()</code>
<div class="block">Returns the method of the target class for which the interceptor was invoked.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>java.lang.Object[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/interceptor/InvocationContext.html#getParameters--">getParameters</a></span>()</code>
<div class="block">Returns the parameter values that will be passed to the method or constructor of the target class.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/interceptor/InvocationContext.html#getTarget--">getTarget</a></span>()</code>
<div class="block">Returns the target instance.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/interceptor/InvocationContext.html#getTimer--">getTimer</a></span>()</code>
<div class="block">Returns the timer object associated with a timeout method invocation on the target class, or a null value for
interceptor method types other than <a href="../../javax/interceptor/AroundTimeout.html" title="annotation in javax.interceptor"><code>AroundTimeout</code></a>.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/interceptor/InvocationContext.html#proceed--">proceed</a></span>()</code>
<div class="block">Proceed to the next interceptor in the interceptor chain.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/interceptor/InvocationContext.html#setParameters-java.lang.Object:A-">setParameters</a></span>(java.lang.Object[]&nbsp;params)</code>
<div class="block">Sets the parameter values that will be passed to the method or constructor of the target class.</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="getTarget--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTarget</h4>
<pre>java.lang.Object&nbsp;getTarget()</pre>
<div class="block">Returns the target instance. For <a href="../../javax/interceptor/AroundConstruct.html" title="annotation in javax.interceptor"><code>AroundConstruct</code></a> lifecycle callback interceptor methods, the
<tt>getTarget</tt> method returns <code>null</code> if called before the <a href="../../javax/interceptor/InvocationContext.html#proceed--"><code>proceed()</code></a> method.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the target instance</dd>
</dl>
</li>
</ul>
<a name="getTimer--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTimer</h4>
<pre>java.lang.Object&nbsp;getTimer()</pre>
<div class="block">Returns the timer object associated with a timeout method invocation on the target class, or a null value for
interceptor method types other than <a href="../../javax/interceptor/AroundTimeout.html" title="annotation in javax.interceptor"><code>AroundTimeout</code></a>. For example, when associated with an EJB component
timeout, this method returns <a href="../../javax/ejb/Timer.html" title="interface in javax.ejb"><code>Timer</code></a>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the timer object or a null value</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Interceptors 1.1</dd>
</dl>
</li>
</ul>
<a name="getMethod--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMethod</h4>
<pre>java.lang.reflect.Method&nbsp;getMethod()</pre>
<div class="block">Returns the method of the target class for which the interceptor was invoked. Returns null in a lifecycle callback
interceptor for which there is no corresponding lifecycle callback method declared in the target class (or inherited
from a superclass) or in an <a href="../../javax/interceptor/AroundConstruct.html" title="annotation in javax.interceptor"><code>AroundConstruct</code></a> lifecycle callback interceptor method.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the method, or a null value</dd>
</dl>
</li>
</ul>
<a name="getConstructor--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getConstructor</h4>
<pre>java.lang.reflect.Constructor&lt;?&gt;&nbsp;getConstructor()</pre>
<div class="block">Returns the constructor of the target class for which the <a href="../../javax/interceptor/AroundConstruct.html" title="annotation in javax.interceptor"><code>AroundConstruct</code></a> interceptor method was invoked.
Returns null for interceptor method types other than <a href="../../javax/interceptor/AroundConstruct.html" title="annotation in javax.interceptor"><code>AroundConstruct</code></a> interceptor methods.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the constructor, or a null value</dd>
</dl>
</li>
</ul>
<a name="getParameters--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getParameters</h4>
<pre>java.lang.Object[]&nbsp;getParameters()</pre>
<div class="block">Returns the parameter values that will be passed to the method or constructor of the target class. If
<a href="../../javax/interceptor/InvocationContext.html#setParameters-java.lang.Object:A-"><code>setParameters(java.lang.Object[])</code></a> has been called, <code>getParameters</code> returns the values to which the parameters have
been set.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the parameter values, as an array</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if invoked within a lifecycle callback method that is not an
<a href="../../javax/interceptor/AroundConstruct.html" title="annotation in javax.interceptor"><code>AroundConstruct</code></a> callback.</dd>
</dl>
</li>
</ul>
<a name="setParameters-java.lang.Object:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setParameters</h4>
<pre>void&nbsp;setParameters(java.lang.Object[]&nbsp;params)</pre>
<div class="block">Sets the parameter values that will be passed to the method or constructor of the target class.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>params</code> - the parameter values, as an array</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if invoked within a lifecycle callback method that is not an
<a href="../../javax/interceptor/AroundConstruct.html" title="annotation in javax.interceptor"><code>AroundConstruct</code></a> callback.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - if the types of the given parameter values do not match the types of
the method or constructor parameters, or if the number of parameters supplied does not equal the number of method or
constructor parameters (if the last parameter is a vararg parameter of type <code>T</code>, it is considered to be
equivalent to a parameter of type <code>T[]</code>).</dd>
</dl>
</li>
</ul>
<a name="getContextData--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getContextData</h4>
<pre>java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;getContextData()</pre>
<div class="block">Enables an interceptor to retrieve or update the data associated with the invocation by another interceptor, business
method, and/or webservices endpoint in the invocation chain. If interceptors are invoked as a result of the
invocation on a web service endpoint, the returned value will be an instance of
<code>javax.xml.rpc.handler.MessageContext</code>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the context data associated with this invocation or lifecycle callback. If there is no context data, an empty
<code>Map&lt;String,Object&gt;</code> object will be returned.</dd>
</dl>
</li>
</ul>
<a name="proceed--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>proceed</h4>
<pre>java.lang.Object&nbsp;proceed()
throws java.lang.Exception</pre>
<div class="block">Proceed to the next interceptor in the interceptor chain. For around-invoke or around-timeout interceptor methods,
the invocation of <code>proceed</code> in the last interceptor method in the chain causes the invocation of the target
class method. For <a href="../../javax/interceptor/AroundConstruct.html" title="annotation in javax.interceptor"><code>AroundConstruct</code></a> lifecycle callback interceptor methods, the invocation of <code>proceed</code>
in the last interceptor method in the chain causes the target instance to be created. For all other lifecycle
callback interceptor methods, if there is no callback method defined on the target class, the invocation of proceed
in the last interceptor method in the chain is a no-op.
<p>
Return the result of the next method invoked, or a null value if the method has return type void.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the return value of the next method in the chain</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - if thrown by target method or interceptor method in call stack</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="../../javax/interceptor/Interceptors.html" title="annotation in javax.interceptor"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/interceptor/InvocationContext.html" target="_top">Frames</a></li>
<li><a href="InvocationContext.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>