2011 JavaOne Fun with EJB 3.1 and OpenEJB

Fun with EJB
                                      and OpenEJB

                          David Blevins
                          @dblevins
                          #OpenEJB




Friday, October 7, 2011
The Basics - History
                          • Timeline
                           • 1999 - Founded in Exoffice - EJB 1.1 level
                           • 2001 - Integrated in Apple’s WebObjects
                           • 2002 - Moved to SourceForge
                           • 2003 - Integrated in Apache Geronimo
                           • 2004 - Moved to Codehaus
                           • 2006 - Moved to Apache Incubator
                           • 2007 - Graduated Apache OpenEJB
                          • Specification involvement
                           • EJB 2.1 (Monson-Haefel)
                           • EJB 3.0 (Blevins)
                           • EJB 3.1 (Blevins)
                           • EJB 3.2 (Blevins)




                                                        2

Friday, October 7, 2011
Focuses since inception
                          • Always an Embeddable EJB Container
                            • Good idea for Embeddable Databases, good idea for us
                            • Our downfall in early 2000 -- people were not ready
                            • Our success after EJB 3.0
                          • No love for traditional Application Servers
                            • Don’t give up main(String[] args)
                          • Always doing the Opposite
                            • Instead of putting the Application in the Container, put the Container in
                              the Application
                          • What do you mean hard to test??
                            • Don’t blame EJB because your Server is hard to test
                            • In what way is mocking not writing an EJB container?




                                                          3

Friday, October 7, 2011
We were only
                          pretending to test




Friday, October 7, 2011
EJB Vision & Philosophy
                          • Misunderstood technology
                           • Many things people attribute to “EJB” are not part of EJB
                          • EJB can be light
                           • EJB as a concept is not heavy, implementations were heavy
                          • EJB can be simpler
                           • Though the API was cumbersome it could be improved
                          • EJB can be used for plain applications
                           • The portability concept can be flipped on end
                           • The flexability applications get also provides great flexability to the
                             container to do things differently yet not break compliance




                                                          5

Friday, October 7, 2011
There is no “heavy”
                             requirement




Friday, October 7, 2011
Show me the heavy




Friday, October 7, 2011
Friday, October 7, 2011
EJB.next and Java EE.next
                          • Promote @ManagedBean to a Session bean
                          • Break up EJB -- separate the toppings
                           • @TransactionManagement
                           • @ConcurrencyManagement
                           • @Schedule
                           • @RolesAllowed
                           • @Asynchronous
                          • Allow all annotations to be used as meta-annotations
                          • Modernize the Connector/MDB relationship
                          • Interceptor improvements
                          • Balance API
                           • Everything that can be turned on should be able to shut off
                          • Improve @ApplicationException


                                                         9

Friday, October 7, 2011
Interceptor -- Today
                              @InterceptorBinding
                          @Target(value = {ElementType.TYPE})
                          @Retention(RetentionPolicy.RUNTIME)
                          public @interface Log {
                          }

                          @Log
                          public class FooBean {

                              public void somethingCommon(){
                                //...

                              public void somethingImportant() {
                               //...

                              public void somethingNoteworthy() {
                                 //...
                          }

                          @Log
                          public class LoggingInterceptor {

                              private java.util.logging.Logger logger =
                                      java.util.logging.Logger.getLogger("theLogger");

                              @AroundInvoke
                              public Object intercept(InvocationContext context) throws Exception {
                                  logger.info("" + context.getMethod().getName());
                                  return context.proceed();
                              }
                          }




                                                                     10

Friday, October 7, 2011
Interceptor Improvements
                              @Log
                          public class FooBean {

                              public void somethingCommon(){
                                  //...
                              }

                              @Info
                              public void somethingImportant() {
                                  //...
                              }

                              @Fine
                              public void somethingNoteworthy() {
                                  //...
                              }
                          }




                                                               11

Friday, October 7, 2011
Interceptor Improvements
                              @Log
                          public class LoggingInterceptor {

                              private java.util.logging.Logger logger =
                                      java.util.logging.Logger.getLogger("theLogger");

                              @AroundInvoke
                              public Object finest(InvocationContext context) throws Exception {
                                  logger.finest("" + context.getMethod().getName());
                                  return context.proceed();
                              }

                              @Info
                              public Object info(InvocationContext context) throws Exception {
                                  logger.info("" + context.getMethod().getName());
                                  return context.proceed();
                              }

                              @Fine
                              public Object fine(InvocationContext context) throws Exception {
                                  logger.fine("" + context.getMethod().getName());
                                  return context.proceed();
                              }
                          }




                                                               12

Friday, October 7, 2011
Meta-Annotations
                              @RolesAllowed({"SuperUser", "AccountAdmin", "SystemAdmin"})
                          @Stereotype
                          @Target(METHOD)
                          @Retention(RUNTIME)
                          public interface Admins {}


                          @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfWeek=”*”, year=”*”)
                          @Stereotype
                          @Target(METHOD)
                          @Retention(RUNTIME)
                          public @interface Hourly {}


                          @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfMonth=”15,Last”, year=”*”)
                          @Stereotype
                          @Target(METHOD)
                          @Retention(RUNTIME)
                          public @interface BiMonthly {}

                          @Singleton
                          @TransactionManagement(CONTAINER)
                          @TransactionAttribute(REQUIRED)
                          @ConcurrencyManagement(CONTAINER)
                          @Lock(READ)
                          @Interceptors({LoggingInterceptor.class, StatisticsInterceptor.class})
                          @Stereotype
                          @Target(TYPE)
                          @Retention(RUNTIME)
                          public @interface SuperBean {}




                                                                  13

Friday, October 7, 2011
Meta-Annotations
                              @Singleton
                          @TransactionManagement(CONTAINER)
                          @TransactionAttribute(REQUIRED)
                          @ConcurrencyManagement(CONTAINER)
                          @Lock(READ)
                          @Interceptors({LoggingInterceptor.class, StatisticsInterceptor.class})
                          public class MyBean {

                              @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfWeek=”*”, year=”*”)
                              public void runBatchJob() {
                                  //...
                              }

                              @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfMonth=”15,Last”, year=”*”)
                              public void sendPaychecks() {
                                  //...
                              }
                              
                              @RolesAllowed({"SuperUser", "AccountAdmin", "SystemAdmin"})
                              public void deleteAccount(String accountId) {
                                  //...
                              }
                          }




                                                                  14

Friday, October 7, 2011
Meta-Annotations
                          @SuperBean
                          public class MyBean {

                              @Hourly
                              public void runBatchJob() {
                                  //...
                              }

                              @BiMonthly
                              public void sendPaychecks() {
                                  //...
                              }
                              
                              @Admin
                              public void deleteAccount(String accountId) {
                                  //...
                              }
                          }




                                                                  15

Friday, October 7, 2011
Testing




Friday, October 7, 2011
Embeded / Testing Principles
                          • Be as invisible as possible
                          • No special classloaders required
                          • No files
                            • All Configuration can be done in the test or via properties
                            • No logging files
                            • No database files (in memory db)
                          • No ports
                            • Remote EJB calls done with “intra-vm” server
                            • JMS done via embedded broker with local transport
                            • Database connections via embedded database
                          • No JavaAgent
                            • Avoidable if not using JPA or if using Hibernate as the provider
                            • OpenJPA to a limited extent



                                                          17

Friday, October 7, 2011
What can you test?
                          • EJBs
                           • @Stateless
                           • @Stateful
                           • @Singleton
                           • @MessageDriven
                           • @ManagedBean
                           • Interceptors
                           • Legacy EJB 2.x and earlier
                          • Views
                           • @Remote
                           • @Local
                           • @LocalBean
                           • @WebService (requires a port)




                                                          18

Friday, October 7, 2011
What can you test? (cont.)
                          • Container Provided resources
                           • DataSources
                           • EntityManagers and EntityManagerFactories
                           • JMS Topics/Queues
                           • WebServiceRefs
                           • Any Java EE Connector provided object
                          • Services
                           • Timers
                           • Transactions
                           • Security
                           • Asynchronous methods




                                                      19

Friday, October 7, 2011
What can’t you test?
                          • Servlets
                          • Filters
                          • Listeners
                          • JSPs
                          • JSF Managed Beans
                          • Non-EJB WebServices


                                          Hello, TomEE



                                                  20

Friday, October 7, 2011
Unique Testing Features
                          • Most spec complete embedded container
                          • Fast startup (1 - 2 seconds)
                          • Test case injection
                          • Overriding
                            • Configuration overriding
                            • Persistence Unit overriding
                            • Logging overriding
                          • Test centric-descriptors
                            • test-specific ejb-jar.xml or persistence.xml, etc.
                          • Validation
                            • Compiler-style output of application compliance issues
                            • Avoid multiple “fix, recompile, redeploy, fail, repeat" cycles
                          • Descriptor output -- great for xml overriding


                                                            21

Friday, October 7, 2011
Questions?




Friday, October 7, 2011
thank you!
                          openejb.apache.org




Friday, October 7, 2011
1 of 23

Recommended

UCLUG TorqueBox - 03/08/2011 by
UCLUG TorqueBox - 03/08/2011UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011tobiascrawley
487 views108 slides
JavaSE - The road forward by
JavaSE - The road forwardJavaSE - The road forward
JavaSE - The road forwardeug3n_cojocaru
640 views30 slides
Puppet camp europe 2011 hackability by
Puppet camp europe 2011   hackabilityPuppet camp europe 2011   hackability
Puppet camp europe 2011 hackabilityPuppet
1.4K views71 slides
PHPUnit & Continuous Integration: An Introduction by
PHPUnit & Continuous Integration: An IntroductionPHPUnit & Continuous Integration: An Introduction
PHPUnit & Continuous Integration: An Introductionalexmace
2.6K views27 slides
Invokedynamic in 45 Minutes by
Invokedynamic in 45 MinutesInvokedynamic in 45 Minutes
Invokedynamic in 45 MinutesCharles Nutter
10K views63 slides
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012 by
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012EJB 3.2 - Java EE 7 - Java One Hyderabad 2012
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012Jagadish Prasath
1.6K views64 slides

More Related Content

Viewers also liked

December 2014 Greater Boston Real Estate Market Trends Report by
December 2014 Greater Boston Real Estate Market Trends ReportDecember 2014 Greater Boston Real Estate Market Trends Report
December 2014 Greater Boston Real Estate Market Trends ReportUnit Realty Group
340 views13 slides
Boston By The Numbers - Boston Housing Stock (Report) by
Boston By The Numbers - Boston Housing Stock (Report)Boston By The Numbers - Boston Housing Stock (Report)
Boston By The Numbers - Boston Housing Stock (Report)Unit Realty Group
545 views5 slides
March 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate by
March 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate March 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate
March 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate Unit Realty Group
259 views7 slides
Ryan rowleylegalpp by
Ryan rowleylegalppRyan rowleylegalpp
Ryan rowleylegalppwalgrowl
160 views13 slides
Ryan rowleylegalpp by
Ryan rowleylegalppRyan rowleylegalpp
Ryan rowleylegalppwalgrowl
176 views13 slides
February 2013's Monthly Indicators report - Boston Real Estate Market Trends by
February 2013's Monthly Indicators report - Boston Real Estate Market TrendsFebruary 2013's Monthly Indicators report - Boston Real Estate Market Trends
February 2013's Monthly Indicators report - Boston Real Estate Market TrendsUnit Realty Group
359 views13 slides

Viewers also liked(11)

December 2014 Greater Boston Real Estate Market Trends Report by Unit Realty Group
December 2014 Greater Boston Real Estate Market Trends ReportDecember 2014 Greater Boston Real Estate Market Trends Report
December 2014 Greater Boston Real Estate Market Trends Report
Unit Realty Group340 views
Boston By The Numbers - Boston Housing Stock (Report) by Unit Realty Group
Boston By The Numbers - Boston Housing Stock (Report)Boston By The Numbers - Boston Housing Stock (Report)
Boston By The Numbers - Boston Housing Stock (Report)
Unit Realty Group545 views
March 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate by Unit Realty Group
March 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate March 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate
March 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate
Unit Realty Group259 views
Ryan rowleylegalpp by walgrowl
Ryan rowleylegalppRyan rowleylegalpp
Ryan rowleylegalpp
walgrowl160 views
Ryan rowleylegalpp by walgrowl
Ryan rowleylegalppRyan rowleylegalpp
Ryan rowleylegalpp
walgrowl176 views
February 2013's Monthly Indicators report - Boston Real Estate Market Trends by Unit Realty Group
February 2013's Monthly Indicators report - Boston Real Estate Market TrendsFebruary 2013's Monthly Indicators report - Boston Real Estate Market Trends
February 2013's Monthly Indicators report - Boston Real Estate Market Trends
Unit Realty Group359 views
February 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate by Unit Realty Group
February 2013 Monthly Multi-family Housing Activity Report - Boston Real EstateFebruary 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate
February 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate
Unit Realty Group222 views
Fun with EJB 3.1 and Open EJB by Arun Gupta
Fun with EJB 3.1 and Open EJBFun with EJB 3.1 and Open EJB
Fun with EJB 3.1 and Open EJB
Arun Gupta3.2K views
Future of Java EE with Java SE 8 by Hirofumi Iwasaki
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8
Hirofumi Iwasaki12.3K views
Top 50 java ee 7 best practices [con5669] by Ryan Cuprak
Top 50 java ee 7 best practices [con5669]Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]
Ryan Cuprak9.3K views
50 EJB 3 Best Practices in 50 Minutes - JavaOne 2014 by Ryan Cuprak
50 EJB 3 Best Practices in 50 Minutes - JavaOne 201450 EJB 3 Best Practices in 50 Minutes - JavaOne 2014
50 EJB 3 Best Practices in 50 Minutes - JavaOne 2014
Ryan Cuprak33K views

Similar to 2011 JavaOne Fun with EJB 3.1 and OpenEJB

2011 JavaOne EJB with Meta Annotations by
2011 JavaOne EJB with Meta Annotations2011 JavaOne EJB with Meta Annotations
2011 JavaOne EJB with Meta AnnotationsDavid Blevins
1.2K views18 slides
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore by
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJava EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJAX London
5K views20 slides
2011 JavaOne Apache TomEE Java EE 6 Web Profile by
2011 JavaOne Apache TomEE Java EE 6 Web Profile2011 JavaOne Apache TomEE Java EE 6 Web Profile
2011 JavaOne Apache TomEE Java EE 6 Web ProfileDavid Blevins
5.7K views20 slides
3D in the Browser via WebGL: It's Go Time by
3D in the Browser via WebGL: It's Go Time 3D in the Browser via WebGL: It's Go Time
3D in the Browser via WebGL: It's Go Time Pascal Rettig
3.5K views39 slides
Introducing the Ceylon Project by
Introducing the Ceylon ProjectIntroducing the Ceylon Project
Introducing the Ceylon ProjectMichael Scovetta
413 views39 slides
Introducing the Ceylon Project - Gavin King presentation at QCon Beijing 2011 by
Introducing the Ceylon Project - Gavin King presentation at QCon Beijing 2011Introducing the Ceylon Project - Gavin King presentation at QCon Beijing 2011
Introducing the Ceylon Project - Gavin King presentation at QCon Beijing 2011devstonez
12.3K views39 slides

Similar to 2011 JavaOne Fun with EJB 3.1 and OpenEJB(20)

2011 JavaOne EJB with Meta Annotations by David Blevins
2011 JavaOne EJB with Meta Annotations2011 JavaOne EJB with Meta Annotations
2011 JavaOne EJB with Meta Annotations
David Blevins1.2K views
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore by JAX London
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJava EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
JAX London5K views
2011 JavaOne Apache TomEE Java EE 6 Web Profile by David Blevins
2011 JavaOne Apache TomEE Java EE 6 Web Profile2011 JavaOne Apache TomEE Java EE 6 Web Profile
2011 JavaOne Apache TomEE Java EE 6 Web Profile
David Blevins5.7K views
3D in the Browser via WebGL: It's Go Time by Pascal Rettig
3D in the Browser via WebGL: It's Go Time 3D in the Browser via WebGL: It's Go Time
3D in the Browser via WebGL: It's Go Time
Pascal Rettig3.5K views
Introducing the Ceylon Project - Gavin King presentation at QCon Beijing 2011 by devstonez
Introducing the Ceylon Project - Gavin King presentation at QCon Beijing 2011Introducing the Ceylon Project - Gavin King presentation at QCon Beijing 2011
Introducing the Ceylon Project - Gavin King presentation at QCon Beijing 2011
devstonez12.3K views
MongoDB at Sailthru: Scaling and Schema Design by DATAVERSITY
MongoDB at Sailthru: Scaling and Schema DesignMongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema Design
DATAVERSITY1.1K views
Javascript Views, Client-side or Server-side with NodeJS by Sylvain Zimmer
Javascript Views, Client-side or Server-side with NodeJSJavascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJS
Sylvain Zimmer4K views
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup. by WO Community
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
WO Community1K views
Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki by fwierzbicki
Jython 2.7 and techniques for integrating with Java - Frank WierzbickiJython 2.7 and techniques for integrating with Java - Frank Wierzbicki
Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
fwierzbicki9.7K views
JVM for Dummies - OSCON 2011 by Charles Nutter
JVM for Dummies - OSCON 2011JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011
Charles Nutter7.7K views
Web micro-framework BATTLE! by Richard Jones
Web micro-framework BATTLE!Web micro-framework BATTLE!
Web micro-framework BATTLE!
Richard Jones122.1K views
02 Objective C by Mahmoud
02 Objective C02 Objective C
02 Objective C
Mahmoud 1.8K views

More from David Blevins

DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS by
DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMSDevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS
DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMSDavid Blevins
88 views49 slides
2019 JJUG CCC Stateless Microservice Security with MicroProfile JWT by
2019 JJUG CCC Stateless Microservice Security with MicroProfile JWT2019 JJUG CCC Stateless Microservice Security with MicroProfile JWT
2019 JJUG CCC Stateless Microservice Security with MicroProfile JWTDavid Blevins
335 views48 slides
2018 jPrime Deconstructing and Evolving REST Security by
2018 jPrime Deconstructing and Evolving REST Security2018 jPrime Deconstructing and Evolving REST Security
2018 jPrime Deconstructing and Evolving REST SecurityDavid Blevins
303 views114 slides
2018 Denver JUG Deconstructing and Evolving REST Security by
2018 Denver JUG Deconstructing and Evolving REST Security2018 Denver JUG Deconstructing and Evolving REST Security
2018 Denver JUG Deconstructing and Evolving REST SecurityDavid Blevins
558 views111 slides
2018 Boulder JUG Deconstructing and Evolving REST Security by
2018 Boulder JUG Deconstructing and Evolving REST Security2018 Boulder JUG Deconstructing and Evolving REST Security
2018 Boulder JUG Deconstructing and Evolving REST SecurityDavid Blevins
147 views111 slides
2018 JavaLand Deconstructing and Evolving REST Security by
2018 JavaLand Deconstructing and Evolving REST Security2018 JavaLand Deconstructing and Evolving REST Security
2018 JavaLand Deconstructing and Evolving REST SecurityDavid Blevins
452 views109 slides

More from David Blevins(15)

DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS by David Blevins
DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMSDevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS
DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS
David Blevins88 views
2019 JJUG CCC Stateless Microservice Security with MicroProfile JWT by David Blevins
2019 JJUG CCC Stateless Microservice Security with MicroProfile JWT2019 JJUG CCC Stateless Microservice Security with MicroProfile JWT
2019 JJUG CCC Stateless Microservice Security with MicroProfile JWT
David Blevins335 views
2018 jPrime Deconstructing and Evolving REST Security by David Blevins
2018 jPrime Deconstructing and Evolving REST Security2018 jPrime Deconstructing and Evolving REST Security
2018 jPrime Deconstructing and Evolving REST Security
David Blevins303 views
2018 Denver JUG Deconstructing and Evolving REST Security by David Blevins
2018 Denver JUG Deconstructing and Evolving REST Security2018 Denver JUG Deconstructing and Evolving REST Security
2018 Denver JUG Deconstructing and Evolving REST Security
David Blevins558 views
2018 Boulder JUG Deconstructing and Evolving REST Security by David Blevins
2018 Boulder JUG Deconstructing and Evolving REST Security2018 Boulder JUG Deconstructing and Evolving REST Security
2018 Boulder JUG Deconstructing and Evolving REST Security
David Blevins147 views
2018 JavaLand Deconstructing and Evolving REST Security by David Blevins
2018 JavaLand Deconstructing and Evolving REST Security2018 JavaLand Deconstructing and Evolving REST Security
2018 JavaLand Deconstructing and Evolving REST Security
David Blevins452 views
2018 IterateConf Deconstructing and Evolving REST Security by David Blevins
2018 IterateConf Deconstructing and Evolving REST Security2018 IterateConf Deconstructing and Evolving REST Security
2018 IterateConf Deconstructing and Evolving REST Security
David Blevins389 views
2018 SDJUG Deconstructing and Evolving REST Security by David Blevins
2018 SDJUG Deconstructing and Evolving REST Security2018 SDJUG Deconstructing and Evolving REST Security
2018 SDJUG Deconstructing and Evolving REST Security
David Blevins399 views
2017 Devoxx MA Deconstructing and Evolving REST Security by David Blevins
2017 Devoxx MA Deconstructing and Evolving REST Security2017 Devoxx MA Deconstructing and Evolving REST Security
2017 Devoxx MA Deconstructing and Evolving REST Security
David Blevins1.1K views
2017 JavaOne Deconstructing and Evolving REST Security by David Blevins
2017 JavaOne Deconstructing and Evolving REST Security2017 JavaOne Deconstructing and Evolving REST Security
2017 JavaOne Deconstructing and Evolving REST Security
David Blevins1.1K views
2017 JCP EC: Configuration JSR by David Blevins
2017 JCP EC: Configuration JSR2017 JCP EC: Configuration JSR
2017 JCP EC: Configuration JSR
David Blevins1.1K views
2017 dev nexus_deconstructing_rest_security by David Blevins
2017 dev nexus_deconstructing_rest_security2017 dev nexus_deconstructing_rest_security
2017 dev nexus_deconstructing_rest_security
David Blevins1K views
2016 JavaOne Deconstructing REST Security by David Blevins
2016 JavaOne Deconstructing REST Security2016 JavaOne Deconstructing REST Security
2016 JavaOne Deconstructing REST Security
David Blevins1K views
2015 JavaOne EJB/CDI Alignment by David Blevins
2015 JavaOne EJB/CDI Alignment2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI Alignment
David Blevins30.7K views
JavaOne 2013 - Apache TomEE, Java EE Web Profile {and more} on Tomcat by David Blevins
JavaOne 2013 - Apache TomEE, Java EE Web Profile {and more} on TomcatJavaOne 2013 - Apache TomEE, Java EE Web Profile {and more} on Tomcat
JavaOne 2013 - Apache TomEE, Java EE Web Profile {and more} on Tomcat
David Blevins2.4K views

Recently uploaded

Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De... by
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...Moses Kemibaro
35 views38 slides
The Power of Heat Decarbonisation Plans in the Built Environment by
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built EnvironmentIES VE
84 views20 slides
Evaluation of Quality of Experience of ABR Schemes in Gaming Stream by
Evaluation of Quality of Experience of ABR Schemes in Gaming StreamEvaluation of Quality of Experience of ABR Schemes in Gaming Stream
Evaluation of Quality of Experience of ABR Schemes in Gaming StreamAlpen-Adria-Universität
38 views34 slides
Future of Indian ConsumerTech by
Future of Indian ConsumerTechFuture of Indian ConsumerTech
Future of Indian ConsumerTechKapil Khandelwal (KK)
36 views68 slides
Initiating and Advancing Your Strategic GIS Governance Strategy by
Initiating and Advancing Your Strategic GIS Governance StrategyInitiating and Advancing Your Strategic GIS Governance Strategy
Initiating and Advancing Your Strategic GIS Governance StrategySafe Software
184 views68 slides
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITShapeBlue
208 views8 slides

Recently uploaded(20)

Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De... by Moses Kemibaro
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...
Moses Kemibaro35 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE84 views
Initiating and Advancing Your Strategic GIS Governance Strategy by Safe Software
Initiating and Advancing Your Strategic GIS Governance StrategyInitiating and Advancing Your Strategic GIS Governance Strategy
Initiating and Advancing Your Strategic GIS Governance Strategy
Safe Software184 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue208 views
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R... by ShapeBlue
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
ShapeBlue178 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue199 views
State of the Union - Rohit Yadav - Apache CloudStack by ShapeBlue
State of the Union - Rohit Yadav - Apache CloudStackState of the Union - Rohit Yadav - Apache CloudStack
State of the Union - Rohit Yadav - Apache CloudStack
ShapeBlue303 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li91 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc176 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue162 views
"Node.js Development in 2024: trends and tools", Nikita Galkin by Fwdays
"Node.js Development in 2024: trends and tools", Nikita Galkin "Node.js Development in 2024: trends and tools", Nikita Galkin
"Node.js Development in 2024: trends and tools", Nikita Galkin
Fwdays33 views
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue183 views
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by Jasper Oosterveld
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue120 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu437 views

2011 JavaOne Fun with EJB 3.1 and OpenEJB

  • 1. Fun with EJB and OpenEJB David Blevins @dblevins #OpenEJB Friday, October 7, 2011
  • 2. The Basics - History • Timeline • 1999 - Founded in Exoffice - EJB 1.1 level • 2001 - Integrated in Apple’s WebObjects • 2002 - Moved to SourceForge • 2003 - Integrated in Apache Geronimo • 2004 - Moved to Codehaus • 2006 - Moved to Apache Incubator • 2007 - Graduated Apache OpenEJB • Specification involvement • EJB 2.1 (Monson-Haefel) • EJB 3.0 (Blevins) • EJB 3.1 (Blevins) • EJB 3.2 (Blevins) 2 Friday, October 7, 2011
  • 3. Focuses since inception • Always an Embeddable EJB Container • Good idea for Embeddable Databases, good idea for us • Our downfall in early 2000 -- people were not ready • Our success after EJB 3.0 • No love for traditional Application Servers • Don’t give up main(String[] args) • Always doing the Opposite • Instead of putting the Application in the Container, put the Container in the Application • What do you mean hard to test?? • Don’t blame EJB because your Server is hard to test • In what way is mocking not writing an EJB container? 3 Friday, October 7, 2011
  • 4. We were only pretending to test Friday, October 7, 2011
  • 5. EJB Vision & Philosophy • Misunderstood technology • Many things people attribute to “EJB” are not part of EJB • EJB can be light • EJB as a concept is not heavy, implementations were heavy • EJB can be simpler • Though the API was cumbersome it could be improved • EJB can be used for plain applications • The portability concept can be flipped on end • The flexability applications get also provides great flexability to the container to do things differently yet not break compliance 5 Friday, October 7, 2011
  • 6. There is no “heavy” requirement Friday, October 7, 2011
  • 7. Show me the heavy Friday, October 7, 2011
  • 9. EJB.next and Java EE.next • Promote @ManagedBean to a Session bean • Break up EJB -- separate the toppings • @TransactionManagement • @ConcurrencyManagement • @Schedule • @RolesAllowed • @Asynchronous • Allow all annotations to be used as meta-annotations • Modernize the Connector/MDB relationship • Interceptor improvements • Balance API • Everything that can be turned on should be able to shut off • Improve @ApplicationException 9 Friday, October 7, 2011
  • 10. Interceptor -- Today @InterceptorBinding @Target(value = {ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Log { } @Log public class FooBean {     public void somethingCommon(){       //...     public void somethingImportant() {      //...     public void somethingNoteworthy() {      //... } @Log public class LoggingInterceptor {     private java.util.logging.Logger logger =             java.util.logging.Logger.getLogger("theLogger");     @AroundInvoke     public Object intercept(InvocationContext context) throws Exception {         logger.info("" + context.getMethod().getName());         return context.proceed();     } } 10 Friday, October 7, 2011
  • 11. Interceptor Improvements @Log public class FooBean {     public void somethingCommon(){         //...     }     @Info     public void somethingImportant() {         //...     }     @Fine     public void somethingNoteworthy() {         //...     } } 11 Friday, October 7, 2011
  • 12. Interceptor Improvements @Log public class LoggingInterceptor {     private java.util.logging.Logger logger =             java.util.logging.Logger.getLogger("theLogger");     @AroundInvoke     public Object finest(InvocationContext context) throws Exception {         logger.finest("" + context.getMethod().getName());         return context.proceed();     }     @Info     public Object info(InvocationContext context) throws Exception {         logger.info("" + context.getMethod().getName());         return context.proceed();     }     @Fine     public Object fine(InvocationContext context) throws Exception {         logger.fine("" + context.getMethod().getName());         return context.proceed();     } } 12 Friday, October 7, 2011
  • 13. Meta-Annotations @RolesAllowed({"SuperUser", "AccountAdmin", "SystemAdmin"}) @Stereotype @Target(METHOD) @Retention(RUNTIME) public interface Admins {} @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfWeek=”*”, year=”*”) @Stereotype @Target(METHOD) @Retention(RUNTIME) public @interface Hourly {} @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfMonth=”15,Last”, year=”*”) @Stereotype @Target(METHOD) @Retention(RUNTIME) public @interface BiMonthly {} @Singleton @TransactionManagement(CONTAINER) @TransactionAttribute(REQUIRED) @ConcurrencyManagement(CONTAINER) @Lock(READ) @Interceptors({LoggingInterceptor.class, StatisticsInterceptor.class}) @Stereotype @Target(TYPE) @Retention(RUNTIME) public @interface SuperBean {} 13 Friday, October 7, 2011
  • 14. Meta-Annotations @Singleton @TransactionManagement(CONTAINER) @TransactionAttribute(REQUIRED) @ConcurrencyManagement(CONTAINER) @Lock(READ) @Interceptors({LoggingInterceptor.class, StatisticsInterceptor.class}) public class MyBean {     @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfWeek=”*”, year=”*”)     public void runBatchJob() {         //...     }     @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfMonth=”15,Last”, year=”*”)     public void sendPaychecks() {         //...     }          @RolesAllowed({"SuperUser", "AccountAdmin", "SystemAdmin"})     public void deleteAccount(String accountId) {         //...     } } 14 Friday, October 7, 2011
  • 15. Meta-Annotations @SuperBean public class MyBean {     @Hourly     public void runBatchJob() {         //...     }     @BiMonthly     public void sendPaychecks() {         //...     }          @Admin     public void deleteAccount(String accountId) {         //...     } } 15 Friday, October 7, 2011
  • 17. Embeded / Testing Principles • Be as invisible as possible • No special classloaders required • No files • All Configuration can be done in the test or via properties • No logging files • No database files (in memory db) • No ports • Remote EJB calls done with “intra-vm” server • JMS done via embedded broker with local transport • Database connections via embedded database • No JavaAgent • Avoidable if not using JPA or if using Hibernate as the provider • OpenJPA to a limited extent 17 Friday, October 7, 2011
  • 18. What can you test? • EJBs • @Stateless • @Stateful • @Singleton • @MessageDriven • @ManagedBean • Interceptors • Legacy EJB 2.x and earlier • Views • @Remote • @Local • @LocalBean • @WebService (requires a port) 18 Friday, October 7, 2011
  • 19. What can you test? (cont.) • Container Provided resources • DataSources • EntityManagers and EntityManagerFactories • JMS Topics/Queues • WebServiceRefs • Any Java EE Connector provided object • Services • Timers • Transactions • Security • Asynchronous methods 19 Friday, October 7, 2011
  • 20. What can’t you test? • Servlets • Filters • Listeners • JSPs • JSF Managed Beans • Non-EJB WebServices Hello, TomEE 20 Friday, October 7, 2011
  • 21. Unique Testing Features • Most spec complete embedded container • Fast startup (1 - 2 seconds) • Test case injection • Overriding • Configuration overriding • Persistence Unit overriding • Logging overriding • Test centric-descriptors • test-specific ejb-jar.xml or persistence.xml, etc. • Validation • Compiler-style output of application compliance issues • Avoid multiple “fix, recompile, redeploy, fail, repeat" cycles • Descriptor output -- great for xml overriding 21 Friday, October 7, 2011
  • 23. thank you! openejb.apache.org Friday, October 7, 2011