SlideShare uma empresa Scribd logo
1 de 23
Baixar para ler offline
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

Mais conteúdo relacionado

Destaque

December 2014 Greater Boston Real Estate Market Trends Report
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
 
Boston By The Numbers - Boston Housing Stock (Report)
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
 
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
March 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate Unit Realty Group
 
Ryan rowleylegalpp
Ryan rowleylegalppRyan rowleylegalpp
Ryan rowleylegalppwalgrowl
 
Ryan rowleylegalpp
Ryan rowleylegalppRyan rowleylegalpp
Ryan rowleylegalppwalgrowl
 
February 2013's Monthly Indicators report - Boston Real Estate Market Trends
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
 
February 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate
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 EstateUnit Realty Group
 
Fun with EJB 3.1 and Open EJB
Fun with EJB 3.1 and Open EJBFun with EJB 3.1 and Open EJB
Fun with EJB 3.1 and Open EJBArun Gupta
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Hirofumi Iwasaki
 
Top 50 java ee 7 best practices [con5669]
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 Cuprak
 
50 EJB 3 Best Practices in 50 Minutes - JavaOne 2014
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 2014Ryan Cuprak
 

Destaque (11)

December 2014 Greater Boston Real Estate Market Trends Report
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
 
Boston By The Numbers - Boston Housing Stock (Report)
Boston By The Numbers - Boston Housing Stock (Report)Boston By The Numbers - Boston Housing Stock (Report)
Boston By The Numbers - Boston Housing Stock (Report)
 
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
March 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate
 
Ryan rowleylegalpp
Ryan rowleylegalppRyan rowleylegalpp
Ryan rowleylegalpp
 
Ryan rowleylegalpp
Ryan rowleylegalppRyan rowleylegalpp
Ryan rowleylegalpp
 
February 2013's Monthly Indicators report - Boston Real Estate Market Trends
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
 
February 2013 Monthly Multi-family Housing Activity Report - Boston Real Estate
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
 
Fun with EJB 3.1 and Open EJB
Fun with EJB 3.1 and Open EJBFun with EJB 3.1 and Open EJB
Fun with EJB 3.1 and Open EJB
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8
 
Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]
 
50 EJB 3 Best Practices in 50 Minutes - JavaOne 2014
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
 

Semelhante a 2011 JavaOne Fun with EJB 3.1 and OpenEJB

2011 JavaOne EJB with Meta Annotations
2011 JavaOne EJB with Meta Annotations2011 JavaOne EJB with Meta Annotations
2011 JavaOne EJB with Meta AnnotationsDavid Blevins
 
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
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
 
2011 JavaOne Apache TomEE Java EE 6 Web Profile
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
 
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
3D in the Browser via WebGL: It's Go Time Pascal Rettig
 
Introducing the Ceylon Project - Gavin King presentation at QCon Beijing 2011
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
 
Introducing the Ceylon Project
Introducing the Ceylon ProjectIntroducing the Ceylon Project
Introducing the Ceylon ProjectMichael Scovetta
 
MongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignMongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignDATAVERSITY
 
Javascript Views, Client-side or Server-side with NodeJS
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 NodeJSSylvain Zimmer
 
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionKelum Senanayake
 
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.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.WO Community
 
Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
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 Wierzbickifwierzbicki
 
JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011Charles Nutter
 
Web micro-framework BATTLE!
Web micro-framework BATTLE!Web micro-framework BATTLE!
Web micro-framework BATTLE!Richard Jones
 
02 Objective C
02 Objective C02 Objective C
02 Objective CMahmoud
 

Semelhante a 2011 JavaOne Fun with EJB 3.1 and OpenEJB (20)

2011 JavaOne EJB with Meta Annotations
2011 JavaOne EJB with Meta Annotations2011 JavaOne EJB with Meta Annotations
2011 JavaOne EJB with Meta Annotations
 
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
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
 
2011 JavaOne Apache TomEE Java EE 6 Web Profile
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
 
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
3D in the Browser via WebGL: It's Go Time
 
Introducing the Ceylon Project - Gavin King presentation at QCon Beijing 2011
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
 
Introducing the Ceylon Project
Introducing the Ceylon ProjectIntroducing the Ceylon Project
Introducing the Ceylon Project
 
MongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignMongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema Design
 
Javascript Views, Client-side or Server-side with NodeJS
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
 
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
 
Geolinkeddata 07042011 1
Geolinkeddata 07042011 1Geolinkeddata 07042011 1
Geolinkeddata 07042011 1
 
GeoLinkedData
GeoLinkedDataGeoLinkedData
GeoLinkedData
 
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.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
 
Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
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
 
JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011
 
Railsconf 2010
Railsconf 2010Railsconf 2010
Railsconf 2010
 
eZ Publish nextgen
eZ Publish nextgeneZ Publish nextgen
eZ Publish nextgen
 
Web micro-framework BATTLE!
Web micro-framework BATTLE!Web micro-framework BATTLE!
Web micro-framework BATTLE!
 
Training python (new Updated)
Training python (new Updated)Training python (new Updated)
Training python (new Updated)
 
Python - the basics
Python - the basicsPython - the basics
Python - the basics
 
02 Objective C
02 Objective C02 Objective C
02 Objective C
 

Mais de David Blevins

DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS
DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMSDevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS
DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMSDavid Blevins
 
2019 JJUG CCC Stateless Microservice Security with MicroProfile JWT
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
 
2018 jPrime Deconstructing and Evolving REST Security
2018 jPrime Deconstructing and Evolving REST Security2018 jPrime Deconstructing and Evolving REST Security
2018 jPrime Deconstructing and Evolving REST SecurityDavid Blevins
 
2018 Denver JUG Deconstructing and Evolving REST Security
2018 Denver JUG Deconstructing and Evolving REST Security2018 Denver JUG Deconstructing and Evolving REST Security
2018 Denver JUG Deconstructing and Evolving REST SecurityDavid Blevins
 
2018 Boulder JUG Deconstructing and Evolving REST Security
2018 Boulder JUG Deconstructing and Evolving REST Security2018 Boulder JUG Deconstructing and Evolving REST Security
2018 Boulder JUG Deconstructing and Evolving REST SecurityDavid Blevins
 
2018 JavaLand Deconstructing and Evolving REST Security
2018 JavaLand Deconstructing and Evolving REST Security2018 JavaLand Deconstructing and Evolving REST Security
2018 JavaLand Deconstructing and Evolving REST SecurityDavid Blevins
 
2018 IterateConf Deconstructing and Evolving REST Security
2018 IterateConf Deconstructing and Evolving REST Security2018 IterateConf Deconstructing and Evolving REST Security
2018 IterateConf Deconstructing and Evolving REST SecurityDavid Blevins
 
2018 SDJUG Deconstructing and Evolving REST Security
2018 SDJUG Deconstructing and Evolving REST Security2018 SDJUG Deconstructing and Evolving REST Security
2018 SDJUG Deconstructing and Evolving REST SecurityDavid Blevins
 
2017 Devoxx MA Deconstructing and Evolving REST Security
2017 Devoxx MA Deconstructing and Evolving REST Security2017 Devoxx MA Deconstructing and Evolving REST Security
2017 Devoxx MA Deconstructing and Evolving REST SecurityDavid Blevins
 
2017 JavaOne Deconstructing and Evolving REST Security
2017 JavaOne Deconstructing and Evolving REST Security2017 JavaOne Deconstructing and Evolving REST Security
2017 JavaOne Deconstructing and Evolving REST SecurityDavid Blevins
 
2017 JCP EC: Configuration JSR
2017 JCP EC: Configuration JSR2017 JCP EC: Configuration JSR
2017 JCP EC: Configuration JSRDavid Blevins
 
2017 dev nexus_deconstructing_rest_security
2017 dev nexus_deconstructing_rest_security2017 dev nexus_deconstructing_rest_security
2017 dev nexus_deconstructing_rest_securityDavid Blevins
 
2016 JavaOne Deconstructing REST Security
2016 JavaOne Deconstructing REST Security2016 JavaOne Deconstructing REST Security
2016 JavaOne Deconstructing REST SecurityDavid Blevins
 
2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI Alignment2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI AlignmentDavid Blevins
 
JavaOne 2013 - Apache TomEE, Java EE Web Profile {and more} on Tomcat
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 TomcatDavid Blevins
 

Mais de David Blevins (15)

DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS
DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMSDevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS
DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS
 
2019 JJUG CCC Stateless Microservice Security with MicroProfile JWT
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
 
2018 jPrime Deconstructing and Evolving REST Security
2018 jPrime Deconstructing and Evolving REST Security2018 jPrime Deconstructing and Evolving REST Security
2018 jPrime Deconstructing and Evolving REST Security
 
2018 Denver JUG Deconstructing and Evolving REST Security
2018 Denver JUG Deconstructing and Evolving REST Security2018 Denver JUG Deconstructing and Evolving REST Security
2018 Denver JUG Deconstructing and Evolving REST Security
 
2018 Boulder JUG Deconstructing and Evolving REST Security
2018 Boulder JUG Deconstructing and Evolving REST Security2018 Boulder JUG Deconstructing and Evolving REST Security
2018 Boulder JUG Deconstructing and Evolving REST Security
 
2018 JavaLand Deconstructing and Evolving REST Security
2018 JavaLand Deconstructing and Evolving REST Security2018 JavaLand Deconstructing and Evolving REST Security
2018 JavaLand Deconstructing and Evolving REST Security
 
2018 IterateConf Deconstructing and Evolving REST Security
2018 IterateConf Deconstructing and Evolving REST Security2018 IterateConf Deconstructing and Evolving REST Security
2018 IterateConf Deconstructing and Evolving REST Security
 
2018 SDJUG Deconstructing and Evolving REST Security
2018 SDJUG Deconstructing and Evolving REST Security2018 SDJUG Deconstructing and Evolving REST Security
2018 SDJUG Deconstructing and Evolving REST Security
 
2017 Devoxx MA Deconstructing and Evolving REST Security
2017 Devoxx MA Deconstructing and Evolving REST Security2017 Devoxx MA Deconstructing and Evolving REST Security
2017 Devoxx MA Deconstructing and Evolving REST Security
 
2017 JavaOne Deconstructing and Evolving REST Security
2017 JavaOne Deconstructing and Evolving REST Security2017 JavaOne Deconstructing and Evolving REST Security
2017 JavaOne Deconstructing and Evolving REST Security
 
2017 JCP EC: Configuration JSR
2017 JCP EC: Configuration JSR2017 JCP EC: Configuration JSR
2017 JCP EC: Configuration JSR
 
2017 dev nexus_deconstructing_rest_security
2017 dev nexus_deconstructing_rest_security2017 dev nexus_deconstructing_rest_security
2017 dev nexus_deconstructing_rest_security
 
2016 JavaOne Deconstructing REST Security
2016 JavaOne Deconstructing REST Security2016 JavaOne Deconstructing REST Security
2016 JavaOne Deconstructing REST Security
 
2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI Alignment2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI Alignment
 
JavaOne 2013 - Apache TomEE, Java EE Web Profile {and more} on Tomcat
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
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Último (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

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