Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ejb-dev] [External] : Re: [jakarta.ee-spec] Interceptors seems like a template spec
  • From: Ed Bratt <ed.bratt@xxxxxxxxxx>
  • Date: Thu, 26 Aug 2021 09:01:14 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rn1yzSCFhB73XxysihRr3k31SzXplmyFAcyZgZrdKAk=; b=WBDgUNrDpbTmT2k1wP2iQ/yMabSBpBH49ns8FqS0jEOAdLeYDDAb4T38ELT33R/2DVEO0Nf72xrAn21xZG9POn7bTQMhCsSJ9m+g6az1A5P26e//ABUNPAWbfSUEHNJZauU2pjs+rtujAo6LWitzamR3sVivtbKoDwUig/HPdRbHi7lM59n+3UwOdpSORBB9kjVsY8rZZEKtMhpCSVh+5UfrD5w+GhtG1Xx5d+4krx0M+v1lTP1cJhyzirNoSNrp/sM2TMtTGQVggZE7H+sFBvJEBk6XCtZDCv297CEEnYpsXPQyOo8fq44glv95i+Ib8sEYTSH8g2jM4WKqvefkvw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ieAuG9Wv6+smtvsq2oXpId5EVP+qTXZ/u5c1Mii0uifZEqK87eDmxvr5yzUww+OxSB8PLAuDqhGOw9pQuW04ljlJoiMt21TdTM7/l2qqoUb5DEezPMtqPy4m/S2XcqtfpCXOIIJSLE8bYEYtjxUYDKu9SNcQmnJiudAQjTUNUhRErCEdJqrTIvA3dLSnoSf+X3OiSGEn/22283tseaI2yoT6+8VefV+aAexgVDwyQcpSO4ZUbMsSOyPCSZqYnJdF+Mri+ekUtzMM4XK/NI3l+FvPWAIBjVbhgLDXPR3ts5MibY1e57BvJmfD7C0YSH8E0feNEd5YgLcd2MqN6iWRLA==
  • Delivered-to: ejb-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/ejb-dev/>
  • List-help: <mailto:ejb-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/ejb-dev>, <mailto:ejb-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/ejb-dev>, <mailto:ejb-dev-request@eclipse.org?subject=unsubscribe>
  • User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

As David writes, Interceptors is used by more than just CDI and I can't really say that flipping everything around to depend on CDI is necessarily a good thing. I think he is illustrating how extracting Interceptors out as a standalone Spec could be a fair amount of work (Interceptors assertions, separated from EJB and possibly elsewhere) -- probably this is why it isn't already extracted separately. That said, I'm sure it's not impossible and ... perhaps if someone were to take some time with this it could be done.

What do people think about trying to extract the core of Interceptors? I'm a fan of  the mantra: where the requirements are defined, the TCKs should follow. So, if CDI has interceptor tests, I would hope those were determined to be assertable features/requirements of the CDI Spec., hence they are in the CDI TCK. If they are, in fact duplicating Interceptor tests -- we might solve that with an extracted Interceptors TCK.

-- Ed

On 8/25/2021 1:41 PM, David Blevins wrote:
I missed one.  Interceptors of an EJB can have injected and lookup all the same things that the EJB can have injected and look up.  For example an Interceptor for an MDB can have `@Resource private MessageDrivenContext mdbContext;` injection and an interceptor of an EJB Session bean can have `@Resource private SessionContext sessionContext;` injection.

Additionally, EJBs have their own private java:comp/env/ namepsace which is completely isolated to it and not seen by other EJBs.  Lets imagine we have a ColorInterceptor that looks up `java:comp/env/favorite/color` and expects a string.  Because each EJB has its own namespace when ColorInterceptor intercepts a method call to BeanA it may get "Blue" as a result.  When ColorInterceptor intercepts a call to BeanB it may get "Red" as a result.

There are tests to ensure that the interceptor of an EJB is seeing the same environment that exact EJB would see, both for dependency injection and lookup.




Back to the top