SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 

Kürzlich hochgeladen (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 

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