What is Java EE Web Profile?
According to the web profile specification, web profile container must support following technologies,
- Servlet 3.0
- JavaServer Pages (JSP) 2.2
- Expression Language (EL) 2.2
- Debugging Support for Other Languages (JSR-45) 1.0
- Standard Tag Library for JavaServer Pages (JSTL) 1.2
- JavaServer Faces (JSF) 2.0
- Common Annotations for theJava Platform (JSR-250) 1.1
- Enterprise JavaBeans (EJB) 3.1 Lite
- Java Transaction API (JTA) 1.1
- Java Persistence API (JPA) 2.0
- Bean Validation 1.0
- Managed Beans 1.0
- Interceptors 1.1
- Contexts and Dependency Injection for the Java EE Platform 1.0
- Dependency Injection for Java 1.0
You could download and get more information from the JCP Page of the specification: JSR 316: JavaTM Platform, Enterprise Edition 6 (Java EE 6) Specification,
http://jcp.org/en/jsr/detail?id=316
SIwpas Features
Using EJB 3.1 Features in WAR
Java EE Web Profile enables you to use "EJB 3.1" features embedded directly in your Java EE Web components. You can use following EJB 3.1 features directly
in your web application/s.
- @Stateless, @Stateful and @Singleton EJB components,
- @Local, @LocalBean (no interface) client views of EJB components,
- Transaction, Interceptor, Security container services.
For example, you can lookup EJB component's proxies from JNDI context like,
01.InitialContext context = new InitialContext();02. 03.//Looking up from global jndi context04.context.lookup("java:global/module_name/bean_name")05.context.lookup("java:global/module_name/bean_name!Interface Name")06. 07.//Looking up from application jndi context08.context.lookup("java:app/module_name/bean_name");09.context.lookup("java:app/module_name/bean_name!Interface Name")10. 11.//Looking up from module jndi context12.context.lookup("java:module/bean_name")13.context.lookup("java:module/bean_name!Interface Name")Module name is your web application name. Bean name is EJB component name. Interface name is name of the interface that EJB component implements.
Web components are able to inject EJB components using "CDI (Context and Dependency Injection)" technology or directly using "@EJB" annotation.
For example, you can use EJB components as "JSF managed beans" or inject them as business services into POJO based JSF managed beans.
Example: Using EJB component as managed beans
01.@Stateless02.@LocalBean03.@Named("paymentService")04.@RequestScoped05.public class PaymentService{06. 07. public String pay(){08. .......09. }10. 11.}OR
inject EJB into POJO based managed bean,
01.@Named("paymentService")02.public class PaymentBean{03. 04. //Injection using CDI05. @Inject PaymentService paymentService;06. 07. //Injection using @EJB08. @EJB PaymentService paymentService;09. 10. public String pay(){11. paymentService.pay();12. }13.} SIwpas fully supports JSR-299 specification via Apache OpenWebBeans project. Moreover, you can use JSR-299 based interceptors and decorators for EJB components.
You can inject EJB components into CDI Beans and vice-versa.
Moreover, SIwpas supports for injecting the following resources into your CDI Beans
- @Resource annotation to inject : DataSource, UserTransaction, ValidatorFactory, Validator, TransactionManager, TransactionSynchronizationRegistry, ORB
- @EJB annotation to inject EJB components,
Example:
01.@Interceptor @PaymentLog02.public PaymentInterceptor{03. 04. @AroundInvoke05. public Object beforePayment(InvocationContext ctx) throws Exception{06. logger.log(....);07. return ctx.proceed();08. }09.}10. 11.@Stateless12.public class PaymentService implements IPaymentService{13. 14. @PaymentLog15. public void pay(...){16. ...17. }18.}Here, @PaymentLog is an interceptor binding. It binds "PaymentInterceptor" to PaymentService pay() method.
You can also use Decorators for EJB components. It is enough to declare decorator class that also implements EJB component client interface.
01.@Decorator02.public PaymentDecorator implements IPaymentService{03. private @Inject @Delegate IPaymentService paymentService;04. 05. public void pay(...){06. //Any business operation you want to do before actual paymentService07. System.out.println(.....);08. 09. //Actual business method execution10. this.paymentService.pay(...);11. }12.}SIwpas Other Features
Lots of cool and new features are provided with Java EE 6 platform. SIwpas supports all of them.
For example,
- @DataSourceDefinitions and @DataSourceDefinition annotation support,
- @Resource(lookup="lookup name") annotation support,
- @ManagedBean annotation support for POJOs,
- Servlet 3.0 features, like @WebServlet, @WebListener for defining servlets and listeners,
- EL 2.2 features,
- And more...
We will provide a cool "SIwpas Console" to manage and introspect internals of SIwpas application server. Our aim is to implement SIwpas console using JSF 2. It will enable you to configure and manage every aspects of SIwpas, such as, EJB container configuration, listing jndi entries, deploy/undeploy applications, performance charts, protocol configuration and much more.
As you have already know that Oracle TCK's for testing Java EE containers are not open source. Therefore, we do not know whether we will request certification from Oracle or not for being compatible with Java EE Web Profile specification. If Oracle could provide us free TCK suite to test our application server, we could definitely use it :) I wish JCP and TCKs would be more open.

No comments:
Post a Comment